Skip to content

CI: use the com_bfstop branch of the same name only if it is ahead of main - #244

Merged
codeling merged 1 commit into
mainfrom
ci-ignore-merged-branches
Oct 25, 2026
Merged

codeling merged 1 commit into
mainfrom
ci-ignore-merged-branches

Conversation

@codeling

Copy link
Copy Markdown
Owner

Problem

The integration jobs check out com_bfstop at the branch with the name of the PR branch if one exists, else main (so a change spanning both repositories is tested together). A branch that was merged and not deleted still exists, but is a stale copy of an old main: the next PR with that name is tested against it. That is what happened to #241 (pin-actions): com_bfstop's merged pin-actions branch predates com_bfstop#21, so the jobs ran against the old component and failed on ComponentTest::testEntriesOfTheEditFormsAreStoredInCanonicalForm, even after #21 was merged.

Change

The "Determine com_bfstop branch" step uses the same-named branch only if it has commits main doesn't (gh api repos/codeling/com_bfstop/compare/main...$branch --jq .ahead_by > 0). A merged branch (ahead by 0) falls back to main, deleted or not.

  • Branch names are checked against ^[A-Za-z0-9._/-]+$ before they go into the API path; anything else uses main.
  • If the API call fails for an existing branch, the step fails instead of silently testing against main.
  • Documented in tests/README.md. The mirror step in com_bfstop's workflow gets the same change (separate PR there).

Tested

The step's script, extracted from the workflow, run against a local bare repository with a fake gh (rev-list --count main..branch):

PR branch result
merged branch, behind main (ahead 0) main
branch with a commit not in main the branch
no such branch main
push to main main
name with shell characters main
API failure on an existing branch step fails

Not run against the real GitHub API from here. The jobs of this PR are the first real run: this PR's branch exists in com_bfstop too (same name, ahead of main), so they should log Using com_bfstop ci-ignore-merged-branches.

Should make #241 pass on a re-run without anyone deleting com_bfstop's stale pin-actions branch (once this is merged and #241 is updated with main).


Generated by Claude Code

…ahead of main

The integration jobs check out the other repository (com_bfstop / bfstop)
at the branch with the name of the PR branch if one exists, else main. A
branch which was merged and not deleted still exists, but is a stale copy of
an old main: the next PR with that name was tested against it (bfstop#241
against com_bfstop's merged pin-actions branch, which lacked #21).

Now the branch is used only if it has commits main hasn't (GitHub compare
API); a failing API call fails the step instead of silently using main.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LhhhdjhErC9ZiaS4HyRjsh
@codeling
codeling merged commit cc6a554 into main Oct 25, 2026
9 checks passed
codeling added a commit that referenced this pull request Oct 25, 2026
Conflict in the "Determine com_bfstop branch" area of ci.yml (#244 changed
the step, this branch pins the checkout action after it): both are kept.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LhhhdjhErC9ZiaS4HyRjsh
@codeling
codeling deleted the ci-ignore-merged-branches branch October 25, 2026 20:57
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