Skip to content

ci(release): sync the open release with main, and keep retarget off the sync PRs - #145

Merged
djessyczaplicki-genomcore merged 3 commits into
release/2026-11-19from
ci/retarget-skip-sync
Nov 19, 2026
Merged

djessyczaplicki-genomcore merged 3 commits into
release/2026-11-19from
ci/retarget-skip-sync

Conversation

@djessyczaplicki-genomcore

@djessyczaplicki-genomcore djessyczaplicki-genomcore commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Merges into the open release branch whatever lands on main in the meantime (hotfixes, docs/ tickets), through a PR, and keeps the daily release's retarget job from tripping over that PR. It replaces #142, so it ships with the next release instead of as a hotfix of its own. Until that release is published, changes merged into main still have to be brought into the release by hand.

A new workflow, Sync release with main, runs on every push to main. When the newest release/YYYY-MM-DD branch is behind main, it points sync/<release> at main and opens a PR from it into the release. The head is sync/<release> rather than main so that conflicts, such as the version after a hotfix, can be resolved in the PR itself without touching main. While that PR is open and has no commits of its own, each push to main moves sync/<release> forward. Once it has commits of its own (resolved conflicts), the workflow leaves it alone. It does nothing once the release has been merged into main.

PRs opened with GITHUB_TOKEN don't trigger other workflows, so a sync PR opened that way has no Tests check until someone closes and reopens it. If the repo has a SYNC_RELEASE_APP_ID variable and a SYNC_RELEASE_APP_KEY secret, the workflow opens the PR with that GitHub App's token instead, and the required checks run. The App needs read and write on Contents, Pull requests and Workflows. It doesn't exist yet. Without it, GITHUB_TOKEN may also be refused when creating sync/<release> while main carries workflow changes, since that token never has the Workflows permission.

In release-daily.yml, retarget used to move the published release's sync PR to the new release. The new release is cut from main, so there are no commits between the two, GitHub answers 422, and under set -euo pipefail the loop stops: the remaining PRs are not moved and the published branch is not deleted. retarget now skips PRs whose head is main or sync/…, and it closes the sync PRs whose base is no longer the open release, deleting their branch. A close that fails only logs a warning. With dry_run it only lists them.

For whoever merges a sync PR: use a merge commit, never squash. A sync merge moves the release branch's head, so the release PR needs a fresh approval (REQUIRE_APPROVAL_ON_HEAD). Merge syncs before approving.

This PR leaves CHANGELOG.md alone, since the release PR writes that section. Suggested entry, under Added: "The open release branch follows main. A new workflow, Sync release with main, opens a PR from sync/<release> into the newest release branch whenever it is behind main, so hotfixes and docs/ tickets reach the release that ships next."

Testing

  • The workflow files parse as YAML, and bash -n passes on every run: step of both workflows.
  • The two jq filters in retarget were run against a sample list of PRs: published-release sync PRs (with sync/ head or main head, and with base a release or main), the open release's own sync PR, and ordinary feature PRs. Only the stale sync PRs are closed, the open release's sync PR is left alone, and only the ordinary PRs remain retarget candidates.
  • CI is green.
  • Neither workflow has run against GitHub yet. The first push to main after this release is published is the first real run of Sync release with main.

🤖 Generated with Claude Code

A sync PR (head main or sync/) was retargeted to the new release when its own
was published; with no commits between them GitHub answered 422 and the loop
stopped. Now retarget skips them and closes those whose release is no longer
the open one.
On every push to main, the newest release/YYYY-MM-DD branch that is behind it
gets a PR from sync/<release>, pointed at main, so conflicts are resolved in
the PR without touching main. With the SYNC_RELEASE_APP_ID variable and
SYNC_RELEASE_APP_KEY secret, the PR is opened with that App's token, so its
required checks run.
@djessyczaplicki-genomcore djessyczaplicki-genomcore changed the title ci(release): retarget leaves sync PRs alone and closes the stale ones ci(release): sync the open release with main, and keep retarget off the sync PRs Nov 17, 2026
@IreneGonPa

Copy link
Copy Markdown
Contributor

stale_syncs (release-daily.yml, bloque nuevo hacia la línea 322): conviene acotar el filtro antes de mergear.

Ahora cierra cualquier PR abierta cuya cabeza sea main o empiece por sync/ y que no apunte a la release abierta. Eso incluye:

  • una PR desde el main de un fork;
  • una rama de feature cualquiera llamada sync/algo contra main, que además se cerraría con --delete-branch.

Hoy no hay ninguna PR abierta así, pero es fácil que aparezca. Propuesta: limitarlo a PRs del mismo repo y a las formas que crea sync-release.yml:

stale_syncs="$(gh pr list --state open --limit 300 --json number,baseRefName,headRefName,isCrossRepository \
  | jq -r --arg t "$target" --arg rel "$RELEASE_BRANCH_RE" '
      .[] | select(.isCrossRepository == false and .baseRefName != $t)
          | select((.headRefName == "main" and (.baseRefName | test($rel)))
                   or (.headRefName | test("^sync/release/[0-9]{4}-[0-9]{2}-[0-9]{2}$")))
          | "\(.number) \(.headRefName)"')"

De paso, en sync-release.yml (rama ya existente sin PR abierta) el PATCH con force=true pisa los commits propios de sync/<release> si alguien cerró la PR después de resolver conflictos. Se podría reutilizar la comprobación compare/main...$branch de unas líneas antes y, si ahead_by > 0, no forzar y avisarlo en el summary.

Base automatically changed from release/2026-11-17 to main November 18, 2026 09:21
@github-actions
github-actions Bot changed the base branch from main to release/2026-11-18 November 18, 2026 10:00
@github-actions

Copy link
Copy Markdown
Contributor

Reapuntada de main a release/2026-11-18, la release abierta. A main solo se llega desde release/, hotfix/ o docs/.

@github-actions
github-actions Bot changed the base branch from release/2026-11-18 to release/2026-11-19 November 19, 2026 09:09
@github-actions

Copy link
Copy Markdown
Contributor

Reapuntada de release/2026-11-18 a release/2026-11-19, la release abierta. A main solo se llega desde release/, hotfix/ o docs/.

A PR into a release branch carries no CHANGELOG change; the release PR
writes that version's section.
@djessyczaplicki-genomcore
djessyczaplicki-genomcore merged commit 0c61a60 into release/2026-11-19 Nov 19, 2026
6 checks passed
@djessyczaplicki-genomcore
djessyczaplicki-genomcore deleted the ci/retarget-skip-sync branch November 19, 2026 14:05
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.

2 participants