-
Notifications
You must be signed in to change notification settings - Fork 1
43 lines (35 loc) · 1.33 KB
/
reusable_run_codespell.yml
File metadata and controls
43 lines (35 loc) · 1.33 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
# NB: Will only process "skip" and "ignore-words-list" from the codespell
# config file if provided
name: Run codespell
on:
workflow_call:
inputs:
config_file:
description: 'Relative path to a codespell config file'
required: false
type: string
default: '.codespellrc'
jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest
env:
CONFIG_FILE: ${{ inputs.config_file }}
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 }}"