summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-05-08 14:49:51 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-05-12 13:56:49 +0200
commit9deaac5c60b37317fddbcb7e5be3c6c5394bb761 (patch)
tree7c00f7f16a0a44f020c1cb4d52b61a38f08ccc0e /.github
parent47b3f9587424834f0a44343a2c799facc5111c1a (diff)
CI: Use gh-cli for changed files, and workaround codespell skip list bug
For PRs, this should give a more accurate list, as the previous method would diff to the tip of the `master` branch, which could include new commits (and thus changed files) not present in the PR branch. codespell's `--skip` option doesn't work at all with folders when used together with an explicit list of paths to work with, so let's not use it. (cherry picked from commit b3bb92ae5ecae0389bbadd7c6933fbae39d74971)
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/static_checks.yml11
1 files changed, 6 insertions, 5 deletions
diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml
index a13e761df8..72c2ee0f02 100644
--- a/.github/workflows/static_checks.yml
+++ b/.github/workflows/static_checks.yml
@@ -28,15 +28,17 @@ jobs:
- name: Get changed files
id: changed-files
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
- files=$(git diff-tree --no-commit-id --name-only -r ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} 2> /dev/null || true)
+ files=$(gh pr diff ${{ github.event.pull_request.number }} --name-only)
elif [ "${{ github.event_name }}" == "push" -a "${{ github.event.forced }}" == "false" -a "${{ github.event.created }}" == "false" ]; then
files=$(git diff-tree --no-commit-id --name-only -r ${{ github.event.before }}..${{ github.event.after }} 2> /dev/null || true)
fi
echo "$files" >> changed.txt
cat changed.txt
- files=$(echo "$files" | tr '\n' ' ')
+ files=$(echo "$files" | grep -v 'thirdparty' | xargs -I {} sh -c 'echo "./{}"' | tr '\n' ' ')
echo "CHANGED_FILES=$files" >> $GITHUB_ENV
- name: File formatting checks (file_format.sh)
@@ -103,7 +105,6 @@ jobs:
if: github.event_name == 'pull_request'
uses: codespell-project/actions-codespell@v1
with:
- skip: ./.*,./**/.*,./bin,./thirdparty,*.desktop,*.gen.*,*.po,*.pot,*.rc,./AUTHORS.md,./COPYRIGHT.txt,./DONORS.md,./core/input/gamecontrollerdb.txt,./core/string/locales.h,./editor/project_converter_3_to_4.cpp,./misc/scripts/codespell.sh,./platform/android/java/lib/src/com,./platform/web/node_modules,./platform/web/package-lock.json
- check_hidden: false
- ignore_words_list: curvelinear,doubleclick,expct,findn,gird,hel,inout,lod,nd,numer,ot,te,vai
+ skip: "*.desktop,*.gen.*,*.po,*.pot,*.rc,./AUTHORS.md,./COPYRIGHT.txt,./DONORS.md,./core/input/gamecontrollerdb.txt,./core/string/locales.h,./editor/project_converter_3_to_4.cpp,./misc/scripts/codespell.sh,./platform/android/java/lib/src/com,./platform/web/node_modules,./platform/web/package-lock.json"
+ ignore_words_list: "curvelinear,doubleclick,expct,findn,gird,hel,inout,lod,nd,numer,ot,te,vai"
path: ${{ env.CHANGED_FILES }}