Skip to content

Commit ad8d79d

Browse files
added new action to get the branch name
1 parent 2b8db97 commit ad8d79d

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

setup/branch-name/action.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Returns the current branch name
2+
description: Returns the current branch name
3+
outputs:
4+
branch-name:
5+
description: The name of the current branch
6+
value: ${{ steps.determine-branch-name.outputs.branch-name }}
7+
runs:
8+
using: "composite"
9+
steps:
10+
- name: Get branch name (merge)
11+
if: github.event_name != 'pull_request'
12+
shell: bash
13+
run: |
14+
echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
15+
16+
- name: Get branch name (pull request)
17+
if: github.event_name == 'pull_request'
18+
shell: bash
19+
run: |
20+
echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV
21+
22+
- name: BRANCH_NAME
23+
id: determine-branch-name
24+
shell: bash
25+
run: |
26+
echo "::set-output name=branch-name::$(echo ${{ env.BRANCH_NAME }} | tr a-z A-Z)"

0 commit comments

Comments
 (0)