Skip to content

Commit abb1bd0

Browse files
committed
build: directly compare file contents before and after
1 parent ff80d7d commit abb1bd0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

.github/workflows/scripts/lint_package_json_files

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,13 @@ echo "Checking package.json files in directories: ${dirs}"
5959
needs_changes=0
6060
for dir in ${dirs}; do
6161
echo "Checking package.json in ${dir}..."
62+
original_content=$(cat "${dir}/package.json")
63+
6264
"${update_package_json_directories}" "${dir}"
6365
"${update_package_json_gypfile}" "${dir}"
64-
if ! git diff-index --quiet HEAD -- "${dir}/package.json"; then
66+
67+
new_content=$(cat "${dir}/package.json")
68+
if [ "$original_content" != "$new_content" ]; then
6569
echo "ERROR: package.json in ${dir} needs updates to directories and/or gypfile fields"
6670
git --no-pager diff "${dir}/package.json"
6771
needs_changes=1

0 commit comments

Comments
 (0)