Skip to content

Trigger the merge sync from an event that actually reaches this file (dev-branch) - #1172

Merged
darksidemilk merged 1 commit into
dev-branchfrom
ci-sync-on-merge-fix-trigger-dev
Aug 18, 2026
Merged

Trigger the merge sync from an event that actually reaches this file (dev-branch)#1172
darksidemilk merged 1 commit into
dev-branchfrom
ci-sync-on-merge-fix-trigger-dev

Conversation

@darksidemilk

Copy link
Copy Markdown
Member

Fixes a bug in #1160: the stub never actually fired

Corrects the trigger on .github/workflows/sync-generated-files.yml. My mistake in #1160, caught by checking whether it had run.

What happened

The stub added in #1160 has not run once. Four PRs merged into working-1.6 since it landed (#1162, #1163, #1164, #1165) and it produced no runs — it didn't even appear in the repository's Actions workflow list:

$ gh api repos/FOGProject/fogproject/actions/workflows
.github/workflows/tests.yml            [active]
Check FOG version                      [disabled_manually]

working-1.6 is currently 1.6.0-beta.3572 where fog-version.sh says it should be 1.6.0-beta.3588 — 16 commits stale, waiting for the daily sweep, which is exactly the gap #1160 was meant to close.

Why

pull_request_target is read from the repository's default branchstable — not from the PR's base branch. GitHub documents it directly: "runs in the context of the default branch of the base repository." That's the general rule for most events; push and create are the exceptions that resolve per-ref. So a copy living on working-1.6/dev-branch is never consulted, no matter how correct its contents.

I reasoned from tests.yml as precedent, which was wrong: that uses pull_request, evaluated from the head-into-base merge ref. That's exactly why one copy per base branch works there, and why it works without a copy on stable.

The fix

pull_request: types: [closed] — read from the base branch, so it reaches this file where it already lives.

The alternative, putting the stub on stable, does work and gives fuller coverage. It was rejected because only stable's copy would ever execute: editing this file on working-1.6 would silently do nothing, and every future change to sync behaviour would need a PR into the release branch.

What that costs

Fork PRs. pull_request withholds secrets from forks, and the reusable workflow needs FOG_WORKFLOWS_PRIVATE_KEY to mint its App token — so a merged fork PR would fail rather than sync. The added same-repo guard skips those, and the daily sweep picks them up. That's the same gap, and the same backstop, that direct pushes already rely on — and a gap the schedule already covers beats a red X on every external contribution.

Unchanged

Still pull_request-family rather than push, so the bot's own fixup push cannot re-fire it and the 2026-07-28 loop stays closed. Still the same branch allowlist keeping rc-*/feature-* on the schedule. Still no logic in this repo.

The header now records why pull_request_target is wrong here, so nobody switches it back on the reasonable-looking grounds that it's the variant which gets fork secrets.

Verification

actionlint clean; trigger and guard confirmed by parsing the file. The real proof is the next merged PR: it should produce a Sync generated files and version run, and that run's own push should queue no second run.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PqufBbuckux8kitJeW3uAK

The stub added in #1160 never fired. Not once, across four PRs merged into
working-1.6 -- it did not even appear in the repository's Actions workflow
list.

The cause is that `pull_request_target` is read from the repository's DEFAULT
branch, `stable`, and not from the pull request's base branch. GitHub
documents this plainly ("runs in the context of the default branch of the
base repository"), and it is the general rule for most events -- `push` and
`create` are the exceptions that resolve per-ref. A copy of the workflow
living on working-1.6 and dev-branch is therefore never consulted, however
correct its contents.

`tests.yml` was the wrong precedent to reason from. It uses `pull_request`,
which is evaluated from the head-into-base merge ref, which is why one copy
per base branch works there and why it works without a copy on stable.

So use `pull_request: types: [closed]`, which is read from the base branch
and therefore reaches this file where it already lives. The alternative --
putting the stub on stable -- would work, but only stable's copy would ever
execute, so editing this file on working-1.6 would silently do nothing and
every future change to the sync behaviour would need a pull request into the
release branch.

That trade costs fork PRs. `pull_request` withholds secrets from a fork, and
the reusable workflow needs FOG_WORKFLOWS_PRIVATE_KEY to mint its App token,
so a merged fork PR would fail rather than sync. The added same-repo guard
skips those instead, and the daily sweep picks them up -- the same gap, and
the same backstop, that direct pushes already rely on. A gap the schedule
already covers beats a red X on every external contribution.

Everything else is unchanged: still `pull_request`-family rather than `push`,
so the bot's own fixup push cannot re-fire it and the 2026-07-28 loop stays
closed; still the same branch allowlist keeping rc-*/feature-* on the
schedule; still no logic in this repo.

The header now records why `pull_request_target` is wrong here, so the next
reader does not switch it back on the reasonable-looking grounds that it is
the variant which gets fork secrets.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PqufBbuckux8kitJeW3uAK
@darksidemilk
darksidemilk merged commit 17b3f43 into dev-branch Aug 18, 2026
2 of 3 checks passed
@darksidemilk
darksidemilk deleted the ci-sync-on-merge-fix-trigger-dev branch August 18, 2026 03:56
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