Skip to content

Commit e6fce04

Browse files
committed
Update spellcheck comment
1 parent 34c8141 commit e6fce04

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

.github/workflows/spelling.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ jobs:
100100
sudo apt-get install aspell aspell-en
101101
102102
- name: Run spell check on each file
103+
id: spellcheck
103104
if: |
104105
steps.check-files.outputs.skip != 'true' &&
105106
steps.check.outputs.skip != 'true'
@@ -118,18 +119,21 @@ jobs:
118119
echo "Checking spelling in $file"
119120
python3 -c "import yaml; config = yaml.safe_load(open('.pyspelling.yml')); new_matrix = [matrix.copy() for matrix in config['matrix'] if (('python' in matrix['name'].lower() and '$file'.endswith('.py')) or ('rest' in matrix['name'].lower() and '$file'.endswith('.rst')) or ('markdown' in matrix['name'].lower() and '$file'.endswith('.md'))) and not matrix.update({'sources': ['$file']})]; config['matrix'] = new_matrix; yaml.dump(config, open('temp_config.yml', 'w'))"
120121
121-
OUTPUT=$(pyspelling -c temp_config.yml 2>&1) || {
122+
if ! OUTPUT=$(pyspelling -c temp_config.yml 2>&1); then
122123
FINAL_EXIT_CODE=1
123-
SPELLCHECK_LOG+="### $file\n$OUTPUT\n\n"
124-
}
124+
SPELLCHECK_LOG="${SPELLCHECK_LOG}### ${file}\n${OUTPUT}\n\n"
125+
fi
125126
fi
126127
done
127128
128-
if [ $FINAL_EXIT_CODE -ne 0 ]; then
129-
echo "spell_failed=true" >> $GITHUB_OUTPUT
129+
{
130+
echo "spell_failed=${FINAL_EXIT_CODE}" >> $GITHUB_OUTPUT
130131
echo "spell_log<<EOF" >> $GITHUB_OUTPUT
131-
echo "$SPELLCHECK_LOG" >> $GITHUB_OUTPUT
132+
echo "${SPELLCHECK_LOG}" >> $GITHUB_OUTPUT
132133
echo "EOF" >> $GITHUB_OUTPUT
134+
}
135+
136+
if [ $FINAL_EXIT_CODE -ne 0 ]; then
133137
exit 1
134138
fi
135139

0 commit comments

Comments
 (0)