-
Notifications
You must be signed in to change notification settings - Fork 17
67 lines (60 loc) · 2.23 KB
/
spell-check.yml
File metadata and controls
67 lines (60 loc) · 2.23 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: Check for Spelling Errors
on:
push:
branches:
- main
pull_request_target:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main
permissions:
actions: read
contents: read
deployments: write
pull-requests: write
id-token: write
jobs:
check-typos:
if: ${{ github.repository_owner != 'getarcaneapp' && github.actor != 'getarcaneappbot' }}
runs-on: depot-ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event.pull_request.head.sha || github.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check if this is a changelog PR
id: check_label
run: |
if [[ "${{ github.event_name }}" == "pull_request_target" ]] \
&& [[ "${{ contains(github.event.pull_request.labels.*.name, 'docs(changelog)') }}" == "true" ]] \
&& [[ "${{ github.event.pull_request.head.repo.full_name }}" == "${{ github.repository }}" ]]; then
echo "is_changelog_pr=true" >> $GITHUB_OUTPUT
echo "should_fix=true" >> $GITHUB_OUTPUT
else
echo "is_changelog_pr=false" >> $GITHUB_OUTPUT
echo "should_fix=false" >> $GITHUB_OUTPUT
fi
- name: Run typos check
uses: crate-ci/typos@v1
with:
config: ./.github/workflows/typos.toml
write_changes: ${{ steps.check_label.outputs.should_fix }}
- name: Check for changes
if: steps.check_label.outputs.should_fix == 'true'
id: verify_diff
run: |
if git diff --quiet; then
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push typo fixes
if: steps.check_label.outputs.should_fix == 'true' && steps.verify_diff.outputs.has_changes == 'true'
run: |
git config --local user.email "info@getarcane.app"
git config --local user.name "getarcaneappbot"
git add -u
git commit -m "fix: auto-correct typos in changelog documentation"
git push