File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -15,14 +15,20 @@ outputs:
15
15
runs :
16
16
using : composite
17
17
steps :
18
- - name : Install Python dependencies
19
- shell : bash
20
- run : pip3 install PyGithub
21
-
22
18
- name : Determine which branch
23
19
id : which-branch
24
20
shell : bash
25
21
run : |
26
- branch="$(python '${{ github.action_path }}/which_branch.py' \
27
- -t "${{ inputs.token }}" -r "${{github.repository }}" "${{ github.sha }}")"
22
+ set -x
23
+ if [[ "$GITHUB_REF_TYPE" != "tag" ]]
24
+ then
25
+ # For a pull request, GITHUB_HEAD_REF is the branch name.
26
+ # For a branch build, GITHUB_REF_NAME is the branch name.
27
+ branch="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}"
28
+ else
29
+ # For a tag build, have to discover which branch corresponds.
30
+ pip3 install PyGithub
31
+ branch="$(python '${{ github.action_path }}/which_branch.py' \
32
+ -t "${{ inputs.token }}" -r "${{github.repository }}" "${{ github.sha }}")"
33
+ fi
28
34
echo "branch=$branch" >> "$GITHUB_OUTPUT"
You can’t perform that action at this time.
0 commit comments