@@ -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'
121120import yaml
122-
121+
123122with open('.pyspelling.yml', 'r') as f :
124123 config = yaml.safe_load(f)
125-
124+
126125new_matrix = []
127126for 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+
136134config['matrix'] = new_matrix
137-
135+
138136with 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