|
1 | 1 | name: Spell checking |
2 | | -on: [pull_request_target, push, issue_comment] |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - "**" |
| 6 | + tags-ignore: |
| 7 | + - "**" |
| 8 | + pull_request_target: |
| 9 | + issue_comment: |
| 10 | + types: [created] |
3 | 11 |
|
4 | 12 | jobs: |
5 | | - build: |
| 13 | + spelling: |
6 | 14 | name: Spell checking |
| 15 | + permissions: |
| 16 | + contents: read |
| 17 | + pull-requests: read |
7 | 18 | runs-on: ubuntu-latest |
| 19 | + if: "contains(github.event_name, 'pull_request') || github.event_name == 'push'" |
8 | 20 | steps: |
9 | 21 | - name: checkout-merge |
10 | 22 | if: "contains(github.event_name, 'pull_request')" |
11 | | - uses: actions/checkout@v2.3.4 |
| 23 | + uses: actions/checkout@v2 |
12 | 24 | with: |
13 | 25 | ref: refs/pull/${{github.event.pull_request.number}}/merge |
14 | 26 | - name: checkout |
15 | | - if: "!contains(github.event_name, 'pull_request')" |
16 | | - |
| 27 | + if: github.event_name == 'push' |
| 28 | + uses: actions/checkout@v2 |
| 29 | + - name: check-spelling |
| 30 | + id: spelling |
| 31 | + uses: check-spelling/check-spelling@prerelease |
| 32 | + with: |
| 33 | + config: .github/actions/spell-check |
| 34 | + experimental_apply_changes_via_bot: 1 |
| 35 | + suppress_push_for_open_pull_request: 1 |
| 36 | + post_comment: 0 |
| 37 | + - name: store-comment |
| 38 | + if: failure() |
| 39 | + uses: actions/upload-artifact@v2 |
| 40 | + with: |
| 41 | + name: "check-spelling-comment-${{ github.run_id }}" |
| 42 | + path: | |
| 43 | + ${{ steps.spelling.outputs.internal_state_directory }} |
17 | 44 |
|
18 | | - - uses: jsoref/check-spelling@prerelease |
| 45 | + comment: |
| 46 | + name: Comment |
| 47 | + runs-on: ubuntu-latest |
| 48 | + needs: spelling |
| 49 | + permissions: |
| 50 | + contents: write |
| 51 | + pull-requests: write |
| 52 | + if: always() && needs.spelling.result == 'failure' |
| 53 | + steps: |
| 54 | + - name: checkout |
| 55 | + uses: actions/checkout@v2 |
| 56 | + - name: set up |
| 57 | + run: | |
| 58 | + mkdir /tmp/data |
| 59 | + - name: retrieve-comment |
| 60 | + uses: actions/download-artifact@v2 |
| 61 | + with: |
| 62 | + name: "check-spelling-comment-${{ github.run_id }}" |
| 63 | + path: /tmp/data |
| 64 | + - name: comment |
| 65 | + uses: check-spelling/check-spelling@prerelease |
| 66 | + with: |
| 67 | + config: .github/actions/spell-check |
| 68 | + experimental_apply_changes_via_bot: 1 |
| 69 | + custom_task: comment |
| 70 | + internal_state_directory: /tmp/data |
| 71 | + debug: 1 |
| 72 | + |
| 73 | + update: |
| 74 | + name: Update PR |
| 75 | + permissions: |
| 76 | + contents: write |
| 77 | + pull-requests: write |
| 78 | + runs-on: ubuntu-latest |
| 79 | + if: ${{ |
| 80 | + github.event_name == 'issue_comment' && |
| 81 | + github.event.issue.pull_request && |
| 82 | + contains(github.event.comment.body, '@check-spelling-bot apply') |
| 83 | + }} |
| 84 | + steps: |
| 85 | + - name: checkout |
| 86 | + uses: actions/checkout@v2 |
| 87 | + - name: check-spelling |
| 88 | + uses: check-spelling/check-spelling@prerelease |
19 | 89 | with: |
20 | 90 | config: .github/actions/spell-check |
21 | 91 | experimental_apply_changes_via_bot: 1 |
| 92 | + debug: 1 |
0 commit comments