Skip to content

Commit abdd90b

Browse files
committed
Stub check-spelling
1 parent 5967a44 commit abdd90b

File tree

2 files changed

+56
-3
lines changed

2 files changed

+56
-3
lines changed

.github/workflows/compact-dictionaries.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,39 @@ jobs:
2323
outputs:
2424
dictionaries: ${{ steps.dictionaries.outputs.dictionaries }}
2525
steps:
26+
- name: checkout
27+
uses: actions/checkout@v4
28+
- name: prepare archive
29+
shell: bash
30+
env:
31+
check_spelling: ${{ inputs.check-spelling }}
32+
manifest: ${{ inputs.manifest }}
33+
run: |
34+
: Prepare archive
35+
archive=$(mktemp -d)/archive.zip
36+
echo "archive=$archive" >> $GITHUB_ENV
37+
perl -pi -e 's<CHECK_SPELLING><$ENV{check_spelling}>;s<VERSION><$ENV{manifest}>' check-spelling-stub.yml
38+
zip "$archive" check-spelling-stub.yml
2639
- name: checkout
2740
uses: actions/checkout@v4
2841
with:
2942
ref: ${{ inputs.branch }}
3043
- name: select dictionaries
3144
id: dictionaries
3245
shell: bash
46+
env:
47+
check_spelling: ${{ inputs.check-spelling }}
48+
manifest: ${{ inputs.manifest }}
3349
run: |
50+
: Select dictionaries
3451
action=$(mktemp)
35-
curl -sL 'https://raw.githubusercontent.com/${{ inputs.check-spelling }}/check-spelling/${{ inputs.manifest }}/action.yml' > "$action"
52+
curl -sL 'https://raw.githubusercontent.com/$check_spelling/check-spelling/refs/heads/$manifest/action.yml' > "$action"
3653
files=$(mktemp)
3754
(
3855
cd dictionaries
3956
perl -ne 'next unless s/^\s*cspell://;my $file=$_; chomp $file; print if -e $file' "$action"
4057
) > "$files"
4158
echo "dictionaries=[$(perl -ne 'next unless s/^(\S+)\n/"$1",/;print' "$files"|perl -pe 's/,$//')]" >> "$GITHUB_OUTPUT"
42-
archive=$(mktemp -d)/archive.zip
4359
(cd dictionaries; zip "$archive" $(cat $files))
4460
echo "archive=$archive" >> "$GITHUB_OUTPUT"
4561
- name: upload
@@ -66,6 +82,7 @@ jobs:
6682
- name: setup check
6783
shell: bash
6884
run: |
85+
: Create sandbox
6986
mkdir -p .github/actions/spelling
7087
echo '\Q${{ matrix.dictionary }}\E$' > .github/actions/spelling/only.txt
7188
unzip /tmp/archive/*.zip "${{ matrix.dictionary }}"
@@ -74,9 +91,12 @@ jobs:
7491
git config user.email "[email protected]"
7592
git add .
7693
git commit -m 'Prepare for check-spelling'
94+
: Create stub action
95+
mkdir -p ../actions/check-spelling
96+
unzip -p /tmp/archive/*.zip check-spelling-stub.yml > ../actions/check-spelling/action.yml
7797
- name: check-spelling
7898
id: spelling
79-
uses: check-spelling/check-spelling@prerelease
99+
uses: ./../actions/check-spelling
80100
with:
81101
event_aliases: '{"workflow_dispatch":"push"}'
82102
suppress_push_for_open_pull_request: 1

check-spelling-stub.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: "Check Spelling Stub"
2+
description: "Spell check code and commits"
3+
inputs:
4+
post_comment:
5+
description:
6+
check_extra_dictionaries:
7+
description:
8+
event_aliases:
9+
description:
10+
suppress_push_for_open_pull_request:
11+
description:
12+
largest_file:
13+
description:
14+
quit_without_error:
15+
description:
16+
checkout:
17+
description:
18+
disable_checks:
19+
description:
20+
21+
runs:
22+
using: "composite"
23+
steps:
24+
- uses: CHECK_SPELLING/check-spelling@VERSION
25+
with:
26+
event_aliases: ${{ inputs.event_aliases }}
27+
suppress_push_for_open_pull_request: ${{ inputs.suppress_push_for_open_pull_request }}
28+
checkout: ${{ inputs.checkout }}
29+
post_comment: ${{ inputs.post_comment }}
30+
check_extra_dictionaries: ${{ inputs.check_extra_dictionaries }}
31+
largest_file: ${{ inputs.largest_file }}
32+
quit_without_error: ${{ inputs.quit_without_error }}
33+
disable_checks: ${{ inputs.disable_checks }}

0 commit comments

Comments
 (0)