spelling.yml 2.8 KB

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