Hello,
in GitLab CI/CD there is a CI_COMMIT_REF_NAME
predefined variable that either stores a tag when it's pushed or a branch name, even when a commit is pushed under opened Merge Request. There is also a CI_MERGE_REQUEST_IID
that stores the Merge Request reference number.
CI_COMMIT_REF_NAME ... The branch or tag name for which project is built
CI_MERGE_REQUEST_IID ... The project-level IID (internal ID) of the merge request. Only available If the pipelines are for merge requests and the merge request is created. This ID is unique for the current project.
Docs
On the other hand in GitHub Actions ref
for commits pushed under opened Pull Requests points to the pull request instead of branch.
I can see that #19 was solved by introducing GITHUB_BRANCH_NAME
. Unfortunately this does not solve the issue when one would like to have a job with a single variable that is populated with either branch name or a tag. This is really useful since both branch names and tags are far more informative than merge request numbers (e.g. docker image tags).
This project's readme states that:
GITHUB_REF_NAME | The branch or tag name that triggered the workflow. If neither a branch or tag is available for the event type, the variable will not exist.
Reading this description at first I thought that it works just like mentioned CI_COMMIT_REF_NAME
from GitLab CI/CD.
I can understand that in GitHub's world for opened Pull Requests the ref
points to an actual PR reference instead of the branch that it is based on. If it would be confusing, problematic, or just not desired to have GITHUB_REF_NAME
and its derivatives work like CI_COMMIT_REF_NAME
in GitLab, could you please consider adding another variable (e.g. COMMIT_REF_NAME
) that works in such way?
Best regards.