-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (57 loc) · 2.05 KB
/
Copy pathspellcheck.yml
File metadata and controls
67 lines (57 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Spellchecker
on:
pull_request:
permissions:
contents: read
pull-requests: write
jobs:
spellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install poetry
run: pipx install codespell
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Check spelling
id: spellcheck
continue-on-error: true
run: uvx codespell > spellcheck.txt
- name: Prepare spellcheck comment body
id: prepare_comment
if: >
hashFiles('spellcheck.txt') != ''
run: |
echo "<!-- lint-notebooks-spellcheck-comment -->" > comment_body.txt
echo "" >> comment_body.txt
cat spellcheck.txt >> comment_body.txt
echo "Generated by GitHub Action run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> comment_body.txt
- name: Find existing comment
uses: peter-evans/find-comment@v3
id: find_comment
if: steps.prepare_comment.outcome == 'success'
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: '<!-- lint-notebooks-spellcheck-comment -->'
- name: Post or Update spell check comment
if: steps.prepare_comment.outcome == 'success'
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ steps.find_comment.outputs.comment-id }}
body-path: comment_body.txt
edit-mode: replace
- name: Determine success on spellchecking errors
if: steps.spellcheck.outcome != 'success'
uses: actions/github-script@v3
with:
script: |
core.setFailed('Found issues with spelling')