ci: bind the branch name to env before writing it to GITHUB_ENV - #6251
Open
kobihikri wants to merge 1 commit into
Open
ci: bind the branch name to env before writing it to GITHUB_ENV#6251kobihikri wants to merge 1 commit into
kobihikri wants to merge 1 commit into
Conversation
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.
Hi, and thanks for Jina.
In
.github/workflows/label-pr.yml, thedeploy-to-netlifyjob writes the branch name into the environment file by interpolation:Actions expands
${{ ... }}into the script text before bash runs, so the branch name becomes part of the command. Git allows$,(,)and backticks in branch names, and$(...)executes inside double quotes — so a PR from a fork on a branch namedx$(id)would run that rather than have its name recorded.There is a second, quieter effect worth mentioning: because this writes to
$GITHUB_ENV, a value containing a newline can define additional environment variables for every later step in the job, not justBRANCH_NAME. The very next step consumes it asref: ${{ env.BRANCH_NAME }}for a checkout ofjina-ai/jina.The change binds the value to a step-level environment variable first:
BRANCH_NAMEstill ends up with the same value and the checkout below is unchanged.On scope: this is a
pull_requesttrigger, so a fork PR carries a read-only token and no secrets. Hardening rather than a live exploit.Disclosure: I used AI assistance to help spot this and prepare the change, and I read the job and the step that consumes
BRANCH_NAMEmyself.