fix: use repo default branch instead of hardcoded 'main' in agent mode#1083
Open
CervEdin wants to merge 1 commit intoanthropics:mainfrom
Open
fix: use repo default branch instead of hardcoded 'main' in agent mode#1083CervEdin wants to merge 1 commit intoanthropics:mainfrom
CervEdin wants to merge 1 commit intoanthropics:mainfrom
Conversation
restoreConfigFromBase (added in v1.0.74) fetches config files from the PR base branch as a security measure. In agent mode, baseBranch falls back to "main" when neither BASE_BRANCH nor the action's baseBranch input is set. On repos whose default branch is "master" (or anything else), this causes `git fetch origin main` to fail, which aborts the entire run. Read the repo's actual default branch from the event payload (repository.default_branch) instead of assuming "main". The payload includes this field on every event type GitHub fires. Fixes anthropics#1080 Signed-off-by: Erik Cervin-Edin <erik.cervin-edin@einride.tech>
Author
|
NGL, I feel like there should be some credit compensation or whatever when I need to use CC to fix anthropics bugs 🤷 |
Author
|
Note that this may not be a complete fix, as noted in #1080
other locations might need similar handling ping @ashwin-ant I think this regression might be related to your changes in 7057f33 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
`restoreConfigFromBase` (added in v1.0.74 via #1066) fetches config
files from the PR base branch as a security measure. In agent mode,
`baseBranch` falls back to `"main"` when neither `BASE_BRANCH` nor
the action's `baseBranch` input is set. On repos whose default branch
is `master` (or anything else), this causes `git fetch origin main`
to fail, which aborts the entire run.
Read the repo's actual default branch from the event payload
(`repository.default_branch`) instead of assuming `"main"`. The
payload includes this field on every event type GitHub fires.
Fixes #1080