|
7 | 7 | paths: |
8 | 8 | - '**/*.md' |
9 | 9 | - '**/*.markdown' |
| 10 | + - '.github/workflows/spell-check.yml' |
| 11 | + - '.github/workflows/config/cspell.json' |
| 12 | + - '.github/workflows/config/local-custom.txt' |
10 | 13 | pull_request: |
11 | 14 | branches: |
12 | 15 | - master |
13 | 16 | paths: |
14 | 17 | - '**/*.md' |
15 | 18 | - '**/*.markdown' |
| 19 | + - '.github/workflows/spell-check.yml' |
| 20 | + - '.github/workflows/config/cspell.json' |
| 21 | + - '.github/workflows/config/local-custom.txt' |
16 | 22 | workflow_dispatch: |
17 | 23 |
|
18 | 24 | jobs: |
|
42 | 48 | *.md |
43 | 49 | separator: '\n' |
44 | 50 |
|
| 51 | + - name: Detect spell-check workflow or configuration changes |
| 52 | + if: github.event_name == 'pull_request' |
| 53 | + id: config |
| 54 | + uses: tj-actions/changed-files@v47 |
| 55 | + with: |
| 56 | + files: | |
| 57 | + .github/workflows/spell-check.yml |
| 58 | + .github/workflows/config/cspell.json |
| 59 | + .github/workflows/config/local-custom.txt |
| 60 | +
|
45 | 61 | - name: Run cspell on changed files (PR) |
46 | | - if: github.event_name == 'pull_request' && steps.files.outputs.any_changed == 'true' |
| 62 | + if: github.event_name == 'pull_request' && steps.config.outputs.any_changed != 'true' && steps.files.outputs.any_changed == 'true' |
47 | 63 | run: | |
48 | 64 | # Convert literal '\n' to real newlines for safe file splitting |
49 | 65 | files_string="${{ steps.files.outputs.all_changed_files }}" |
|
60 | 76 | # Run cspell on all changed files; its exit code will control the workflow outcome |
61 | 77 | cspell --no-must-find-files --config .github/workflows/config/cspell.json "${files[@]}" |
62 | 78 |
|
63 | | - - name: Run cspell on all markdown files (push to main or manual) |
64 | | - if: github.event_name != 'pull_request' |
| 79 | + - name: Run cspell on all markdown files (workflow/config changes, push or manual) |
| 80 | + if: github.event_name != 'pull_request' || steps.config.outputs.any_changed == 'true' |
65 | 81 | run: | |
66 | 82 | cspell --config .github/workflows/config/cspell.json "5.0/en/**/*.md" "*.md" |
0 commit comments