You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* fix: query repo default branch instead of hardcoding 'main' (#20098)
When no explicit base branch is configured and the event context doesn't
provide one, getBaseBranch() was falling back to hardcoded "main".
This caused failures for repos whose default branch is not "main"
(e.g. "master", "develop") - the git fetch for the base branch
would fail with "fatal: couldn't find remote ref main".
Fix: add a new step 5 that queries the GitHub API for the repository's
default_branch before falling back to DEFAULT_BRANCH env var or "main".
* fix: resolve base branch before cross-repo checkout; remove hardcoded 'master' fallback
- In create_pull_request.cjs, move getBaseBranch() resolution to before
checkoutManager.switchTo() so cross-repo checkout uses the correct
default branch instead of hardcoded 'main'
- In dynamic_checkout.cjs, remove the hardcoded 'master' fallback when
'main' is not found. This assumed only 'main' or 'master' could be the
default branch, which is incorrect. The resolved branch is now always
passed correctly by the caller.
* test: add tests for no-silent-master-fallback behavior in dynamic_checkout
* perf: use context.payload.repository.default_branch before API call in step 5
Most GitHub Actions event payloads include repository.default_branch,
so we can read it directly from the payload without making an API call.
Only fall back to repos.get() when:
- targetRepo is explicitly provided (cross-repo: payload would have the
wrong repo's default branch)
- The payload doesn't include repository.default_branch
This matches the pattern used in dispatch_workflow.cjs and avoids
unnecessary API calls that count against rate limits.
* update get base branch
0 commit comments