We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 59f0518 commit 4446d9cCopy full SHA for 4446d9c
which-branch/action.yaml
@@ -23,6 +23,15 @@ runs:
23
id: which-branch
24
shell: bash
25
run: |
26
- branch="$(python '${{ github.action_path }}/which_branch.py' \
27
- -t "${{ inputs.token }}" -r "${{github.repository }}" "${{ github.sha }}")"
+ set -x
+ if [[ "$GITHUB_REF_TYPE" != "tag" ]]
28
+ then
29
+ # For a pull request, GITHUB_HEAD_REF is the branch name.
30
+ # For a branch build, GITHUB_REF_NAME is the branch name.
31
+ branch="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}"
32
+ else
33
+ # For a tag build, have to discover which branch corresponds.
34
+ branch="$(python '${{ github.action_path }}/which_branch.py' \
35
+ -t "${{ inputs.token }}" -r "${{github.repository }}" "${{ github.sha }}")"
36
+ fi
37
echo "branch=$branch" >> "$GITHUB_OUTPUT"
0 commit comments