Skip to content

Commit

Permalink
Update sync-release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesPeck committed Oct 11, 2024
1 parent 354c9b0 commit 1ef64c0
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/sync-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- main
workflow_dispatch: # allows manual triggers
workflow_dispatch:

jobs:
update-release-branch:
Expand All @@ -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: |
Expand All @@ -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',
Expand Down

0 comments on commit 1ef64c0

Please sign in to comment.