GitHub has its own contexts that you could use while working with GitHub actions which you could use in certain scenarios. The most confusing thing I stumble upon was choosing between github.head_ref
and github.ref_name
. Which one is it?
Prerequisites
- GitHub
Solution
github.ref_name
: points to the branch or the tag that triggered the workflow run.github.head_ref
: points to the source branch of the PR. This only works for pull requests and that’s the key point.
Conclusion
In case you face any issues, feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.