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:
148148 # Define the path to a utility for linting package.json files:
149149 lint_package_json="${root}/lib/node_modules/@stdlib/_tools/lint/pkg-json/bin/cli"
150150
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+
151155 files=$(echo "${{ steps.changed-files.outputs.files }}" | tr ' ' '\n' | grep 'package\.json$' | grep -v 'datapackage\.json$' | tr '\n' ' ' | sed 's/ $//')
152156 if [ -n "${files}" ]; then
153157 echo "Linting package.json files that have changed..."
154158 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
155178 else
156179 echo "No package.json files to lint."
157180 fi
You can’t perform that action at this time.
0 commit comments