Skip to content

Commit

Permalink
source and base branch diff
Browse files Browse the repository at this point in the history
  • Loading branch information
mirkoSekulic committed Jan 21, 2025
1 parent 0fa20b4 commit feaec17
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
30 changes: 20 additions & 10 deletions .github/workflows/desiger-check-quartz-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,12 @@ jobs:
with:
fetch-depth: 0

- name: output base branch
id: output-base-branch
run: echo "base-branch=${{ github.head_ref }}"

- name: Check if quartz library is updated
id: check-quartz-update
run: |
source_branch=${{ github.head_ref }} # Get the base branch
diff=$(git diff --unified=0 $source_branch...backend/packagegroups/NuGet.props | grep + | grep Quartz | grep Version)
git fetch origin ${{ github.base_ref }} && git checkout ${{ github.base_ref }}
git fetch origin ${{ github.head_ref }} && git checkout ${{ github.head_ref }}
diff=$(git diff --unified=0 ${{ github.base_ref }}...${{ github.head_ref }} -- backend/packagegroups/NuGet.props | grep + | grep Quartz | grep Version)
if [ -n "$diff" ]; then
echo "is-updated=true" >> $GITHUB_OUTPUT
else
Expand All @@ -40,7 +37,7 @@ jobs:
id: get-quartz-version
if: steps.check-quartz-update.outputs.is-updated == 'true'
run: |
version=$(git diff --unified=0 backend/packagegroups/NuGet.props | grep Quartz | grep Version | grep + | sed -n 's/.*Version="\([^"]*\)".*/\1/p')
version=$(git diff --unified=0 ${{ github.base_ref }}...${{ github.head_ref }} -- backend/packagegroups/NuGet.props | grep Quartz | grep Version | grep + | sed -n 's/.*Version="\([^"]*\)".*/\1/p')
echo "quartz-version=$version" >> $GITHUB_OUTPUT
- name: Verify tables sql is not updated
Expand All @@ -51,11 +48,24 @@ jobs:
jq -r '.assets[] | select(.name | contains("Quartz.NET-${{ steps.get-quartz-version.outputs.quartz-version }}.zip")) | .browser_download_url')
mkdir qdwn
curl -L -o qdwn/quartz.zip $download_url && unzip qdwn/quartz.zip && rm qdwn/quartz.zip
curl -L -o qdwn/quartz.zip $download_url && unzip qdwn/quartz.zip -d qdwn && rm qdwn/quartz.zip
diff=$(diff -u backend/src/Designer/Migrations/Quartz/tables_postgres.sql qdwn/database/tables/tables_postgres.sql)
echo "before diff command"
diff_output=$(diff -b backend/src/Designer/Migrations/SqlScripts/QuartzTables/tables_postgres.sql qdwn/database/tables/tables_postgres.sql)
if [ -n "$diff" ]; then
echo "outputing diff"
echo $diff_output
echo "finished outputing diff"
echo "repo file: "
cat backend/src/Designer/Migrations/SqlScripts/QuartzTables/tables_postgres.sql
echo "end repo file"
echo "quartz file: "
cat qdwn/database/tables/tables_postgres.sql
echo "end quartz file"
if [ -n "$diff_output" ]; then
exit 1;
else
echo "Tables file is up to date"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
set client_min_messages = WARNING;
DROP TABLE IF EXISTS qrtz_fired_triggers;
DROP TABLE IF EXISTS qrtz_paused_trigger_grps;
DROP TABLE IF EXISTS qrtz_scheduler_state;
Expand All @@ -10,7 +9,7 @@ DROP TABLE IF EXISTS qrtz_blob_triggers;
DROP TABLE IF EXISTS qrtz_triggers;
DROP TABLE IF EXISTS qrtz_job_details;
DROP TABLE IF EXISTS qrtz_calendars;
set client_min_messages = NOTICE;


CREATE TABLE qrtz_job_details
(
Expand Down

0 comments on commit feaec17

Please sign in to comment.