-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
37 lines (37 loc) · 1.16 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: 'Set Git Branch'
author: Joshua Estrin Skrzypek <https://github.com/jskrzypek>
description: |
Sets the git branch name as a consistent env var & output. If the event is
triggered by a tag, no value will be set.
branding:
icon: git-branch
color: orange
outputs:
branch-name:
description: "The branch name"
value: ${{ steps.set-output.outputs.branch-name }}
runs:
using: "composite"
steps:
- name: Set Git Branch Name for PR Events
id: branch-name-from-pr
if: |-
github.event_name == 'pull_request'
|| github.event_name == 'pull_request_target'
run: |
echo "GIT_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
shell: bash
- name: Set Git Branch Name for non-PR Branch Events
id: branch-name-from-non-pr
if: |-
github.event_name != 'pull_request'
&& github.event_name != 'pull_request_target'
&& github.ref_type == 'branch'
run: |
echo "GIT_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
shell: bash
- name: Set output from env var
id: set-output
run: |
echo "::set-output name=branch-name::${{ env.GIT_BRANCH }}"
shell: bash