What are the `github.ref`, `github.ref_name`, `github.head_ref` and `github.base_ref` values for a PR from `feature/x` into `main`?
IntermediateConceptContexts, Expressions, Env & Outputs
Answer
For pull_request:
github.ref:refs/pull/42/mergegithub.ref_name:42/mergegithub.head_ref:feature/xgithub.base_ref:maingithub.sha: the test merge commit, not the PR head; the head isgithub.event.pull_request.head.sha
For push to main: ref is refs/heads/main, ref_name is main, and head_ref/base_ref are empty.
More on Contexts, Expressions, Env & Outputs
List the available contexts and what each holds.BeginnerWhich contexts can you use in which keys? Give two examples that trip people up.AdvancedWhat are the expression operators and how do comparisons coerce types?IntermediateHow do you write a ternary in GitHub Actions expressions?IntermediateWhat do `contains`, `startsWith`, `endsWith`, `format` and `join` do?BeginnerWhat are object filters (`.*`) and how are they useful?Intermediate