From 242f5cbd060d387180c7fc5adcde6edc99941362 Mon Sep 17 00:00:00 2001 From: Greg Chadwick Date: Thu, 18 May 2023 16:02:42 +0100 Subject: [PATCH] [ci] Use GH CLI tool to determine changed files 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 --- .github/workflows/pr_change_check.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr_change_check.yml b/.github/workflows/pr_change_check.yml index 45c86264f869d8..e1d49b7b968370 100644 --- a/.github/workflows/pr_change_check.yml +++ b/.github/workflows/pr_change_check.yml @@ -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