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 6f2a656
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/pr_change_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,14 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- 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 6f2a656

Please sign in to comment.