Skip to content

Commit

Permalink
[ci] Use GH CLI tool to determine changed files
Browse files Browse the repository at this point in the history
Previous method was flawed and would produce a list of every file
changed on master since the PR commit was branched off it. So in general
the older the PR the more unconnected to the PR files would appear on
the list.

Signed-off-by: Greg Chadwick <[email protected]>
  • Loading branch information
GregAC committed May 18, 2023
1 parent 4ae5192 commit 242f5cb
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/pr_change_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ jobs:

- name: Determine changed files
run: |
pr_ref="refs/pull/${{ github.event.number }}/merge"
echo $pr_ref
git fetch origin "$pr_ref"
git diff --name-only \
"origin/${{ github.base_ref }}" \
FETCH_HEAD > $HOME/changed_files
pr_url="https://github.com/${{ github.repository }}/pull/${{ github.event.number }}"
echo $pr_url
gh pr diff $pr_url --name-only > $HOME/changed_files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Show files changed
run: cat $HOME/changed_files
Expand Down

0 comments on commit 242f5cb

Please sign in to comment.