Skip to content

Commit f0c7cb8

Browse files
committed
Update
1 parent 555417d commit f0c7cb8

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

.github/workflows/spelling.yml

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -116,27 +116,7 @@ jobs:
116116
for file in "${FILES[@]}"; do
117117
if [ -n "$file" ]; then
118118
echo "Checking spelling in $file"
119-
cat > temp_config.py << 'EOL'
120-
import yaml
121-
122-
with open('.pyspelling.yml', 'r') as f:
123-
config = yaml.safe_load(f)
124-
125-
new_matrix = []
126-
for matrix in config['matrix']:
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-
134-
config['matrix'] = new_matrix
135-
136-
with open('temp_config.yml', 'w') as f:
137-
yaml.dump(config, f, default_flow_style=False)
138-
EOL
139-
python3 temp_config.py
119+
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'))"
140120
141121
if ! pyspelling -c temp_config.yml; then
142122
FINAL_EXIT_CODE=1
@@ -148,3 +128,4 @@ EOL
148128
echo "Spell check failed!"
149129
exit 1
150130
fi
131+

0 commit comments

Comments
 (0)