-
-
Notifications
You must be signed in to change notification settings - Fork 3
46 lines (44 loc) · 1.75 KB
/
branch.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
38
39
40
41
42
43
44
45
46
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestbranchestags
name: Branch
on:
push:
# Sequence of patterns matched against refs/heads
branches:
# Push events on main branch
- main
# Push events on master branch
- master
# Push events to branches matching refs/heads/mona/octocat
- 'mona/octocat'
# Push events to branches matching refs/heads/releases/10
- 'releases/**'
# Push events to branches not matching releases/10-alpha or releases/beta/3-alpha
- '!releases/**-alpha'
# Sequence of patterns matched against refs/tags
tags:
- v1 # Push events to v1 tag
- v1.* # Push events to v1.0, v1.1, and v1.9 tags
pull_request:
# Sequence of patterns matched against refs/heads
branches-ignore:
# Do not push events to branches matching refs/heads/mona/octocat
- 'mona/octocat'
# Do not push events to branches matching refs/heads/releases/beta/3-alpha
- 'releases/**-alpha'
# Sequence of patterns matched against refs/tags
tags-ignore:
- v1.* # Do not push events to tags v1.0, v1.1, and v1.9
jobs:
branch:
runs-on: ubuntu-latest
steps:
- run: echo ${{ github.ref }}
- run: echo $GITHUB_REF
- run: echo "${GITHUB_REF##*/}"
- run: echo "branch is master"
if: github.ref == 'refs/heads/master'
- run: echo "branch is not master"
if: github.ref != 'refs/heads/master'
# `github.head_ref` is set when the workflow was triggered by a `pull_request`
# `github.ref_name` is set when the workflow was not triggered by a `pull_request`
- run: echo ${{ github.head_ref || github.ref_name }}