Skip to content

Commit 5a0845f

Browse files
committed
TA-511 Fix for reading branch name in the workflow
1 parent 59bec6f commit 5a0845f

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Test workflow
2+
3+
on:
4+
push:
5+
branches:
6+
- TA-511-fix-workflow
7+
8+
env:
9+
JAVA_VERSION: 17
10+
BRANCH: ""
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-22.04
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Generate build number
18+
uses: einaregilsson/build-number@v3
19+
with:
20+
token: ${{secrets.ACCESS_TOKEN}}
21+
22+
check-current-branch:
23+
runs-on: ubuntu-22.04
24+
steps:
25+
- name: check branch
26+
shell: bash
27+
run: |
28+
echo "Setting up branch name"
29+
echo "envs: ${{ toJson(env) }}"
30+
echo "BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV
31+
echo "envs: ${{ toJson(env) }}"
32+
branch="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
33+
echo="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
34+
echo "BRANCH1=${GITHUB_HEAD_REF}"
35+
echo "BRANCH2=${GITHUB_REF#refs/heads/}"
36+
echo "BRANCH=$branch" >> $GITHUB_ENV
37+
echo "envs: ${{ toJson(env) }}"
38+
echo "BRANCH = ${{ env.BRANCH }}"
39+
- name: test1
40+
if: env.BRANCH == 'develop'
41+
shell: brash
42+
run: |
43+
echo "This is develop"
44+
- name: test2
45+
if: env.BRANCH == 'A-511-fix-workflow'
46+
shell: brash
47+
run: |
48+
echo "This is A-511-fix-workflow"

0 commit comments

Comments
 (0)