From 1ef64c00db229ba4795d0cd4ec8c6888fdde181a Mon Sep 17 00:00:00 2001 From: James Date: Fri, 11 Oct 2024 10:02:04 -0400 Subject: [PATCH] Update sync-release.yml --- .github/workflows/sync-release.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/sync-release.yml b/.github/workflows/sync-release.yml index d78f5666..6044038a 100644 --- a/.github/workflows/sync-release.yml +++ b/.github/workflows/sync-release.yml @@ -4,7 +4,7 @@ on: push: branches: - main - workflow_dispatch: # allows manual triggers + workflow_dispatch: jobs: update-release-branch: @@ -14,7 +14,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 with: - fetch-depth: 0 # Fetch the full history + fetch-depth: 0 - name: Set up Git run: | @@ -31,25 +31,28 @@ jobs: git fetch origin main if git diff --quiet origin/main; then echo "No differences, safe to proceed." + echo "diff_found=false" >> $GITHUB_OUTPUT else echo "::error::Differences found between release and main!" - exit 1 + echo "diff_found=true" >> $GITHUB_OUTPUT + fi - name: Reset release branch to main - if: steps.diff-check.outcome == 'success' # Only proceed if no differences found + if: steps.diff-check.outputs.diff_found == 'false' run: | git reset --hard origin/main - name: Force push release branch - if: steps.diff-check.outcome == 'success' + if: steps.diff-check.outputs.diff_found == 'false' run: git push origin release --force - name: Notify via GitHub Issue if differences found - if: failure() # This runs if there were differences found and the job failed + if: steps.diff-check.outputs.diff_found == 'true' uses: actions/github-script@v6 with: + github-token: ${{secrets.GITHUB_TOKEN}} script: | - await github.issues.create({ + github.rest.issues.create({ owner: context.repo.owner, repo: context.repo.repo, title: 'Sync Failure: Differences found between main and release',