-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
GitHub define GITHUB_REF_NAME as default environment variable #104
Comments
Since GitHub default environment variables cannot be overwritten, the This impacts the v3, and v4 series. |
In order to fix that in the current series, we need to choose a new name for the I kind of mix between
In addition, if the current |
Another possibility would be to quit the
Instead of (for example)
But we will still need to choose a new name to avoid confusion between |
After some tests, when you define a new environment variable, the steps:
- name: create NEW_ENVIRONMENT_VARIABLE using shell
run: echo "NEW_ENVIRONMENT_VARIABLE=SOME_VALUE" >>$GITHUB_ENV
shell: bash
- name: Echo from 'env.NEW_ENVIRONMENT_VARIABLE' will print 'SOME_VALUE'
run: echo "${{ env.NEW_ENVIRONMENT_VARIABLE }}"
shell: bash
- name: Echo from '$NEW_ENVIRONMENT_VARIABLE' will print 'SOME_VALUE'
run: echo "${NEW_ENVIRONMENT_VARIABLE}"
shell: bash But the default environment variables are not available in the steps:
- name: Echo from 'env.GITHUB_REF_NAME' will print nothing
run: echo "${{ env.GITHUB_REF_NAME }}"
shell: bash
- name: Echo from '$GITHUB_REF_NAME' will print the branch or tag name
run: echo "${GITHUB_REF_NAME}"
shell: bash When you used the steps:
- name: create GITHUB_REF_NAME using shell
run: echo "GITHUB_REF_NAME=SOME_VALUE" >>$GITHUB_ENV
shell: bash But since a default environment variable cannot be overwritten, the shell environment variables remain unchanged, which is not the case in the
Since the The v3 and the v4 aren't impacted in the same way.
|
To "fix" it, I choose to document this behavior in v3 and v4
And I will also fix the bug in v4 to have the same v3 behavior. In the near future,
|
This could have been detected much sooner with #77 😁 |
🎉 This issue has been resolved in version 4.2.4 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Describe the bug
GitHub releases a new environment variable:
GITHUB_REF_NAME
.Since this action also uses
GITHUB_REF_NAME
name.The GitHub version cannot be overwritten by this action, and the export is silently discarded.
The action version doesn't fill this variable the same way GitHub does.
And the current content doesn't match the content produced by this action (before the GitHub release) on pull request event.
On GitHub-side,
GITHUB_REF_NAME
isGITHUB_REF
without therefs
prefix.GITHUB_REF
= refs/pull/42/mergeGITHUB_REF_NAME
= 42/mergeGITHUB_REF_NAME
= <Name of the head branch of PR 42>To Reproduce
Use this action on a pull request-based workflow.
Expected behavior
GITHUB_REF_NAME
contains the branch behind the Pull request.The text was updated successfully, but these errors were encountered: