Skip to content
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

for pull_request GITHUB_REF_NAME doesn't contains actual branch name #19

Closed
jupe opened this issue Nov 24, 2020 · 1 comment · Fixed by #21
Closed

for pull_request GITHUB_REF_NAME doesn't contains actual branch name #19

jupe opened this issue Nov 24, 2020 · 1 comment · Fixed by #21
Assignees
Labels
enhancement New feature or request

Comments

@jupe
Copy link

jupe commented Nov 24, 2020

If job is triggered using pull_request there is no actual branch available in GITHUB_REF_NAME. This looks a bit issue in GitHub context side since there is no clear variable where to get branch name regardless how job is triggered. Maybe branch name extracting should be separate variable that works also for pull_requests.

gitHub.ref: "refs/pull/844/merg
head_ref: "my-branch",
GITHUB_REF_SLUG: refs-pull-844-merge
GITHUB_REF_NAME: 844/merge
GITHUB_REF_NAME_SLUG: 844-merge
@FranzDiebold
Copy link
Owner

Hi @jupe ,
thanks for your feedback!
You're right, GITHUB_REF_NAME is not set for event type pull_request by GitHub.

That's why I improved github-env-vars-action in version v1.3.0 📦 to solve this issue: There's now a new environment variable GITHUB_BRANCH_NAME exactly for this use case! 💪 It contains the branch name for both event types push and pull_request.

Have fun using github-env-vars-action and give it a ⭐.

@FranzDiebold FranzDiebold added the enhancement New feature or request label Nov 27, 2020
@FranzDiebold FranzDiebold linked a pull request Nov 27, 2020 that will close this issue
@FranzDiebold FranzDiebold self-assigned this Nov 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants