File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -148,10 +148,33 @@ jobs:
148
148
# Define the path to a utility for linting package.json files:
149
149
lint_package_json="${root}/lib/node_modules/@stdlib/_tools/lint/pkg-json/bin/cli"
150
150
151
+ # Define paths to utilities for updating package.json metadata fields:
152
+ update_package_json_directories="${root}/lib/node_modules/@stdlib/_tools/package-json/scripts/update_directories"
153
+ update_package_json_gypfile="${root}/lib/node_modules/@stdlib/_tools/package-json/scripts/update_gypfile"
154
+
151
155
files=$(echo "${{ steps.changed-files.outputs.files }}" | tr ' ' '\n' | grep 'package\.json$' | grep -v 'datapackage\.json$' | tr '\n' ' ' | sed 's/ $//')
152
156
if [ -n "${files}" ]; then
153
157
echo "Linting package.json files that have changed..."
154
158
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
155
178
else
156
179
echo "No package.json files to lint."
157
180
fi
You can’t perform that action at this time.
0 commit comments