Skip to content

Commit

Permalink
chore(ci): better check for Nocks changes (#491)
Browse files Browse the repository at this point in the history
When there are no changes, asking Git to compare the db file directly
will always report change even though the actual data stored is the
same. Instead, we can compare a SQL dump to detect actual changes.

Co-authored-by: Kristoffer K. <[email protected]>
  • Loading branch information
aduh95 and merceyz authored Jun 6, 2024
1 parent e1d8ffd commit 3da5346
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .github/workflows/update-nock-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ jobs:

- name: Check if anything has changed
id: contains-changes
run: echo "result=$(git --no-pager diff --quiet -- tests/nocks.db || echo "yes")" >> $GITHUB_OUTPUT
run: |
sqlite3 tests/nocks.db .dump > /tmp/before.sql
cp tests/nocks.db tests/nocks.db.new
git checkout HEAD -- tests/nocks.db
sqlite3 tests/nocks.db .dump > /tmp/after.sql
echo "result=$(git --no-pager diff --quiet --no-index /tmp/before.sql /tmp/after.sql || echo "yes")" >> "$GITHUB_OUTPUT"
mv tests/nocks.db.new tests/nocks.db
shell: bash

- name: Commit changes
Expand Down

0 comments on commit 3da5346

Please sign in to comment.