Skip to content

fix: skip sync gracefully when triggered from non-develop branch (GHO-121)#333

Merged
noahwhite merged 1 commit intodevelopfrom
feature/GHO-121-fix-sync-workflow-main-branch
Mar 16, 2026
Merged

fix: skip sync gracefully when triggered from non-develop branch (GHO-121)#333
noahwhite merged 1 commit intodevelopfrom
feature/GHO-121-fix-sync-workflow-main-branch

Conversation

@noahwhite
Copy link
Owner

Problem

The Sync TryGhost Compose Images workflow runs on schedule and workflow_dispatch, both of which always run from the default branch (main). Even though the workflow checks out develop at step level, GITHUB_REF_NAME is still main — so any step that checked for the template file on the checked-out develop content was the wrong signal.

Previously the workflow had no guard at all, so it would fail when run from main if the template was absent on that branch.

Fix

Add a guard step immediately after checkout that checks GITHUB_REF_NAME:

Condition Outcome
GITHUB_REF_NAME != 'develop' Emit ::notice::, set skip=true, all subsequent steps are skipped
GITHUB_REF_NAME == 'develop' and template missing Emit ::error::, exit 1 — this is a real failure
GITHUB_REF_NAME == 'develop' and template present Set skip=false, sync proceeds normally

All subsequent steps are conditioned on steps.verify.outputs.skip != 'true' (in addition to their existing has_changes == 'true' guards).

Closes GHO-121

…-121)

Scheduled and workflow_dispatch triggers always run from the default branch
(main). Checkout of develop happens at step level, but GITHUB_REF_NAME still
reflects 'main'. Guard step now checks GITHUB_REF_NAME:
- Not 'develop': emit notice and skip all subsequent steps
- 'develop' with missing template: fail with error (unchanged behaviour)
- 'develop' with template present: proceed normally
@linear
Copy link

linear bot commented Mar 16, 2026

@noahwhite noahwhite self-assigned this Mar 16, 2026
@noahwhite noahwhite merged commit 304a0cb into develop Mar 16, 2026
6 checks passed
@noahwhite noahwhite deleted the feature/GHO-121-fix-sync-workflow-main-branch branch March 16, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant