Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github action: Doesn't correctly compute the commit_range when using pull_request_target #517

Open
tru opened this issue Sep 6, 2023 · 0 comments

Comments

@tru
Copy link

tru commented Sep 6, 2023

Describe the bug
If the action is triggered on pull_request_target instead of pull_request the auto-detection doesn't work.

To Reproduce

here is my action file:

name: "Check Python Formatting"
on:
  pull_request_target:
    # run on .py
    paths:
      - '**.py'

jobs:
  python_formatting:
    runs-on: ubuntu-latest
    steps:
      - name: Fetch sources
        uses: actions/checkout@v4
        with:
          persist-credentials: false
          fetch-depth: 2

      - name: Get changed files
        id: changed-files
        uses: tj-actions/changed-files@v39
        with:
          files: '**/*.py'

      - name: "Listed files"
        run: |
          echo "Formatting files:"
          echo "${{ steps.changed-files.outputs.all_changed_files }}"

      - name: Setup Python env
        uses: actions/setup-python@v4
        with:
          python-version: '3.11'

      - name: Python Formatting
        uses: akaihola/darker@1.7.2
        with:
          options: "--check --diff --color"
          version: "~=1.7.2"
          src: "${{ steps.changed-files.outputs.all_changed_files }}"

This doesn't work unless I change to pull_request on the third line.

Expected behavior
It should work for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant