Skip to content

Commit 555417d

Browse files
committed
Update
1 parent 9b046a7 commit 555417d

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

.github/workflows/spelling.yml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -116,25 +116,35 @@ jobs:
116116
for file in "${FILES[@]}"; do
117117
if [ -n "$file" ]; then
118118
echo "Checking spelling in $file"
119-
# Create a temporary config file based on the existing one
120-
python3 - <<EOF > temp_config.yml
119+
cat > temp_config.py << 'EOL'
121120
import yaml
122-
121+
123122
with open('.pyspelling.yml', 'r') as f:
124123
config = yaml.safe_load(f)
125-
124+
126125
new_matrix = []
127126
for matrix in config['matrix']:
128-
129-
if (('python' in matrix['name'].lower() and '$file'.endswith('.py')) or
130-
('reST' in matrix['name'] and '$file'.endswith('.rst')) or
131-
('markdown' in matrix['name'].lower() and '$file'.endswith('.md'))):
132-
matrix_copy = matrix.copy()
133-
matrix_copy['sources'] = ['$file']
134-
new_matrix.append(matrix_copy)
135-
127+
if (('python' in matrix['name'].lower() and '$file'.endswith('.py')) or
128+
('reST' in matrix['name'].lower() and '$file'.endswith('.rst')) or
129+
('markdown' in matrix['name'].lower() and '$file'.endswith('.md'))):
130+
matrix_copy = matrix.copy()
131+
matrix_copy['sources'] = ['$file']
132+
new_matrix.append(matrix_copy)
133+
136134
config['matrix'] = new_matrix
137-
135+
138136
with open('temp_config.yml', 'w') as f:
139137
yaml.dump(config, f, default_flow_style=False)
140-
EOF
138+
EOL
139+
python3 temp_config.py
140+
141+
if ! pyspelling -c temp_config.yml; then
142+
FINAL_EXIT_CODE=1
143+
fi
144+
fi
145+
done
146+
147+
if [ $FINAL_EXIT_CODE -ne 0 ]; then
148+
echo "Spell check failed!"
149+
exit 1
150+
fi

0 commit comments

Comments
 (0)