[eas-cli] Keep the branch name in workflow:run --ref - #4355
Open
dennytosp wants to merge 1 commit into
Open
Conversation
`--ref` resolved the ref locally with `git rev-parse` and sent only the resulting commit hash, so the branch or tag name never reached the server. Runs dispatched from the CLI were labeled with a 40-character hash, which also filled the website's Git branch filter with hashes. Send branch and tag names through untouched instead. `HEAD`, revision expressions and remote-tracking refs keep being resolved locally, since they either mean nothing in the remote repository or mean something else there. Fixes expo#4311
|
Subscribed to pull request
Generated by CodeMention Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead. |
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.
Closes #4311.
Why
workflow:run --ref <branch>resolves the ref withgit rev-parseand sends the resulting commit hash asgitRef, so the branch name never reaches the server.WorkflowRunstoresrequestedGitRefandgitCommitHashseparately — the website's Branch column and its Git-branch filter both readrequestedGitRef— so a CLI-triggered run is labelled with a 40-character hash while the same workflow started from the dashboard's Run workflow button keeps the branch name. The filter fills with hashes and stops being usable.This was flagged during review of the PR that added
--ref(#3203):The local
rev-parsewas only meant to support--ref HEAD; it ended up applying to every ref.What changed
resolveWorkflowRunGitRefpicks what to send. Branch and tag names go through untouched, in short (my-branch) or fully qualified (refs/heads/my-branch) form. Everything else keeps being sent as the locally resolved commit, because it either has no meaning in the remote repository or does not mean the same thing there:--ref--symbolic-full-namemy-branch,feat/x,v1.0,refs/heads/…,refs/tags/…refs/heads|tags/…HEAD,@refs/heads/<current>HEADHEADHEAD~2, raw hashorigin/my-branchrefs/remotes/…heads/my-branchrefs/heads/my-branchHEADdeliberately keeps the old behaviour: it resolves to the default branch server-side, so passing it through would silently run against the wrong branch.rev-parseis still called, so an invalid ref fails exactly as before, and the log line now shows both (at my-branch (abc1234…)).Testing
12 new tests in
run.test.ts. Red/green: replacing the helper body with the oldreturn commitShafails the 5 pass-through cases with the reported bug (Expected "my-branch", received "0e5c2f18…"), while the 7 cases that guardHEAD/detached/expression/hash/remote-tracking behaviour pass in both states.Note:
src/vcs/clients/__tests__/git.test.tscan hit its 5s per-test timeout under parallel load. That is pre-existing — it reproduces on a cleanmainwith these changes stashed.