-
Notifications
You must be signed in to change notification settings - Fork 32
46 lines (38 loc) · 1.52 KB
/
run_codespell.yml
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
# Note: This workflow allows specifying a custom location for the Codespell
# configuration file by defining CONFIG_FILE as an environment variable.
# A defined subset of options is extracted from this file and passed to the
# Codespell action. This also ensures that the output of the codespell action
# prints out the values of these options.
# Todo: Generalize the extraction of codespell input arguments/options.
name: Codespell
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest
env:
CONFIG_FILE: .codespellrc
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract codespell configurations from configuration file
id: config
run: |
# Extract 'skip' value from the config file, excluding 'skip = ' part
skip=$(grep -E '^skip' "$CONFIG_FILE" | sed 's/^skip *= *//')
# Extract 'ignore-words-list' value from the config file, excluding 'ignore-words-list = ' part
ignore_words=$(grep -E '^ignore-words-list' "$CONFIG_FILE" | sed 's/^ignore-words-list *= *//')
# Export values as environment variables
echo "SKIP=$skip" >> $GITHUB_ENV
echo "IGNORE_WORDS_LIST=$ignore_words" >> $GITHUB_ENV
- name: Codespell
uses: codespell-project/actions-codespell@v2
with:
skip: "${{ env.SKIP }}"
ignore_words_list: "${{ env.IGNORE_WORDS_LIST }}"