Merge pull request #76842 from akien-mga/ci-codespell-fix-skip-list

CI: Use gh-cli for changed files, and workaround codespell skip list bug
This commit is contained in:
Rémi Verschelde 2023-05-08 16:40:18 +02:00
commit cf8ad12b56
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 7 additions and 6 deletions

View File

@ -28,15 +28,17 @@ jobs:
- name: Get changed files - name: Get changed files
id: changed-files id: changed-files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then 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 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) files=$(git diff-tree --no-commit-id --name-only -r ${{ github.event.before }}..${{ github.event.after }} 2> /dev/null || true)
fi fi
echo "$files" >> changed.txt echo "$files" >> changed.txt
cat 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 echo "CHANGED_FILES=$files" >> $GITHUB_ENV
- name: File formatting checks (file_format.sh) - name: File formatting checks (file_format.sh)
@ -103,7 +105,6 @@ jobs:
if: github.event_name == 'pull_request' if: github.event_name == 'pull_request'
uses: codespell-project/actions-codespell@v1 uses: codespell-project/actions-codespell@v1
with: 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 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"
check_hidden: false ignore_words_list: "curvelinear,doubleclick,expct,findn,gird,hel,inout,lod,nd,numer,ot,te,vai"
ignore_words_list: curvelinear,doubleclick,expct,findn,gird,hel,inout,lod,nd,numer,ot,te,vai
path: ${{ env.CHANGED_FILES }} path: ${{ env.CHANGED_FILES }}

View File

@ -44,7 +44,7 @@ static void _add_file(String f, const uint64_t &p_modified_time, HashMap<String,
const uint64_t *cached_mt = cached_files.getptr(f); const uint64_t *cached_mt = cached_files.getptr(f);
if (cached_mt && *cached_mt == p_modified_time) { if (cached_mt && *cached_mt == p_modified_time) {
// File is good, skip it. // File is good, skip it.
cached_files.erase(f); // Erase to mark this file as existing. Remaning files not added to files_to_send will be considered erased here, so they need to be erased in the client too. cached_files.erase(f); // Erase to mark this file as existing. Remaining files not added to files_to_send will be considered erased here, so they need to be erased in the client too.
return; return;
} }
files_to_send.insert(f, p_modified_time); files_to_send.insert(f, p_modified_time);