| 1 |
name: 🚥 Codespell |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
on: |
| 9 |
pull_request: |
| 10 |
types: [opened, edited, synchronize] |
| 11 |
|
| 12 |
jobs: |
| 13 |
codespell: |
| 14 |
runs-on: ubuntu-latest |
| 15 |
steps: |
| 16 |
- uses: actions/checkout@v4 |
| 17 |
|
| 18 |
- name: 🔸 Get Changed Files from Pull Request |
| 19 |
env: |
| 20 |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 21 |
run: | |
| 22 |
# get file names and separate them with space ' ' |
| 23 |
#files=$(gh pr diff ${{ github.event.pull_request.number }} --name-only | xargs -I {} sh -c "echo \'./{}\'" | tr '\n' ' ') |
| 24 |
gh pr diff ${{ github.event.pull_request.number }} --name-only | xargs -I {} sh -c 'echo ./{}' | sort >/tmp/changed |
| 25 |
gh api '/repos/rear/rear/git/trees/master?recursive=true' -q '.tree[]|.path' | xargs -I {} sh -c 'echo ./{}' | sort >/tmp/full |
| 26 |
comm -23 /tmp/full /tmp/changed > ./exclude_file |
| 27 |
echo "EXCLUDE_FILE=./exclude_file" >> "$GITHUB_ENV" |
| 28 |
|
| 29 |
- name: 🔸 Output the Exclude File |
| 30 |
run: cat ${{ env.EXCLUDE_FILE }} |
| 31 |
|
| 32 |
- name: 🔸 Check for Spelling Errors for Changed Files |
| 33 |
uses: codespell-project/actions-codespell@v2 |
| 34 |
with: |
| 35 |
check_filenames: true |
| 36 |
check_hidden: true |
| 37 |
ignore_words_file: .codespellignore |
| 38 |
skip: .git,./renovate.json,./LICENSE,./MAINTAINERS,*.8,*.pdf,*.html,*.yml |
| 39 |
exclude_file: ${{ env.EXCLUDE_FILE }} |
| 40 |
|
| 41 |
|