@@ -152,33 +152,34 @@ jobs:
152
152
update_package_json_directories="${root}/lib/node_modules/@stdlib/_tools/package-json/scripts/update_directories"
153
153
update_package_json_gypfile="${root}/lib/node_modules/@stdlib/_tools/package-json/scripts/update_gypfile"
154
154
155
+ # Lint changed package.json files:
155
156
files=$(echo "${{ steps.changed-files.outputs.files }}" | tr ' ' '\n' | grep 'package\.json$' | grep -v 'datapackage\.json$' | tr '\n' ' ' | sed 's/ $//')
156
157
if [ -n "${files}" ]; then
157
158
echo "Linting package.json files that have changed..."
158
159
printf "${files}" | "${lint_package_json}" --split=" "
159
-
160
- # Check if metadata fields need to be updated:
161
- dirs=$(dirname ${files})
162
- needs_changes=0
163
- for dir in ${dirs}; do
164
- echo "Checking package.json in ${dir}..."
165
- "${update_package_json_directories}" "${dir}"
166
- "${update_package_json_gypfile}" "${dir}"
167
- if [[ `git status --porcelain` ]]; then
168
- echo "::error::Package.json in ${dir} needs updates to directories and/or gypfile fields"
169
- git diff
170
- needs_changes=1
171
- fi
172
- done
173
-
174
- # Exit with failure if any needed changes were detected:
175
- if [ $needs_changes -eq 1 ]; then
176
- exit 1
177
- fi
178
160
else
179
161
echo "No package.json files to lint."
180
162
fi
181
163
164
+ # Check if metadata fields need to be updated in package.json files of affected packages:
165
+ dirs=$(echo "${{ steps.changed-files.outputs.files }}" | tr ' ' '\n' | xargs dirname | sort -u)
166
+ needs_changes=0
167
+ for dir in ${dirs}; do
168
+ echo "Checking package.json in ${dir}..."
169
+ "${update_package_json_directories}" "${dir}"
170
+ "${update_package_json_gypfile}" "${dir}"
171
+ if [[ `git status --porcelain` ]]; then
172
+ echo "::error::Package.json in ${dir} needs updates to directories and/or gypfile fields"
173
+ git diff
174
+ needs_changes=1
175
+ fi
176
+ done
177
+
178
+ # Exit with failure if any needed changes were detected:
179
+ if [ $needs_changes -eq 1 ]; then
180
+ exit 1
181
+ fi
182
+
182
183
# Lint REPL help files...
183
184
- name : ' Lint REPL help files'
184
185
if : success() || failure()
0 commit comments