The GITHUB_REF var is currently returning value like "refs/pull/421/merge" which contains no mention of any branch name from which the PR was created. How can I achieve the same?
If you're in yaml, then I believe it would be github.payload.pull_request.head.ref (see https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions#github-context).
@jaredly Here's my problem, I am trying to use bundlesize package for my repo using github actions. The package uses another package called ci-env which reads branch name from process.env.GITHUB_REF here, which is wrong. So I just wanted to replace this env var value with the context value you suggested. But I see here that the GITHUB_ env vars can't be overridden. What should be done now?
I have raised a PR to fix this
process.env.GITHUB_HEAD_REF || process.env.GITHUB_REF && process.env.GITHUB_REF.split('/')
should suffice, right?