-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
workflows/remote-bazel: fix default branch not found #6283
Merged
Merged
Conversation
This file contains 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
sluongng
force-pushed
the
sluongng/fix-remote-bazel-workflow
branch
2 times, most recently
from
April 1, 2024 13:33
d95fb63
to
f749f62
Compare
bduffany
reviewed
Apr 2, 2024
maggie-lou
reviewed
Apr 2, 2024
sluongng
force-pushed
the
sluongng/fix-remote-bazel-workflow
branch
from
April 3, 2024 14:56
f749f62
to
dc6c336
Compare
maggie-lou
reviewed
Apr 3, 2024
sluongng
force-pushed
the
sluongng/fix-remote-bazel-workflow
branch
7 times, most recently
from
April 5, 2024 14:46
bca6e56
to
d2346b1
Compare
sluongng
force-pushed
the
sluongng/fix-remote-bazel-workflow
branch
from
April 5, 2024 15:14
8a5eb7c
to
bf1238c
Compare
bduffany
approved these changes
Apr 5, 2024
maggie-lou
added a commit
that referenced
this pull request
Apr 12, 2024
This reverts commit e52435b.
maggie-lou
added a commit
that referenced
this pull request
Apr 12, 2024
This reverts commit e52435b.
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.
Listing all local branches to find the default branch could yield unreliable results.
For example, in Github Action, there is no local
refs/heads/{master,main}
written by theactions/checkout
plugin.It's also interesting how
refs/remote/origin/HEAD
symbolic ref is not written, so trying to use the symbolic ref might not work.refs/remote/origin/master
is written conditionally based on whetherfetch-depth: 0
is configured in theactions/checkout
plugin or not.Employ 2 strategies to detect the default branch:
local
andremote
.For
local
strategy, we attempt to readrefs/heads/{master,main}
, each, from 2 places: in the.git/refs
directory and the.git/packed-refs
file.For
remote
strategy, rungit ls-remote origin
and see if eitherrefs/heads/{master,main}
exists.