diff --git a/.github/check_for_changes.py b/.github/check_for_changes.py index f2f4f8bf13..17f64a5539 100644 --- a/.github/check_for_changes.py +++ b/.github/check_for_changes.py @@ -15,16 +15,15 @@ def main(): return try: - commit = 'HEAD' - upstream = 'master' + commit = os.environ.get('PR_NUMBER') - mb = run_cmd(f"git merge-base {upstream} {commit}") - upstream = mb[0] - - print(f"upstream: {upstream}") + # mb = run_cmd(f"git merge-base {upstream} {commit}") + # upstream = mb[0] + # + # print(f"upstream: {upstream}") result = subprocess.run( - ['git', 'diff', '--name-only', upstream, commit, '--', 'autopts/wid/'], + ['git', 'diff', '--name-only', 'HEAD', commit, '--', 'autopts/wid/'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, check=True ) diff --git a/.github/workflows/run_cron_from_pr.yaml b/.github/workflows/run_cron_from_pr.yaml index e8a15141c4..f36a36325a 100644 --- a/.github/workflows/run_cron_from_pr.yaml +++ b/.github/workflows/run_cron_from_pr.yaml @@ -1,11 +1,14 @@ name: Check PR for changes in autopts/wid/ on: - pull_request_target: + pull_request: types: [ready_for_review, opened] branches: - master +env: + PR_NUMBER: ${{ github.event.number }} + jobs: check_changes: runs-on: ubuntu-latest @@ -15,6 +18,12 @@ jobs: with: fetch-depth: 2 + - name: Display PR Number (debug) + run: echo "PR Number is ${{ env.PR_NUMBER }}" + + - name: Fetch PR refs + run: git fetch origin pull/${{ env.PR_NUMBER }}/head:pr-${{ env.PR_NUMBER }} + - name: Check for changes in autopts/wid directory id: check_changes run: |