Skip to content

TA-511 Fix for reading branch name in the workflow #11

TA-511 Fix for reading branch name in the workflow

TA-511 Fix for reading branch name in the workflow #11

Workflow file for this run

name: Test workflow
on:
push:
branches:
- TA-511-fix-workflow
env:
JAVA_VERSION: 17
BRANCH: ""
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Generate build number
uses: einaregilsson/build-number@v3
with:
token: ${{secrets.ACCESS_TOKEN}}
check-current-branch:
runs-on: ubuntu-22.04
steps:
- name: check branch
shell: bash
run: |
echo "Setting up branch name"
echo "envs: ${{ toJson(env) }}"
echo "BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV
echo "envs: ${{ toJson(env) }}"
branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
echo "BRANCH=$branch" >> $GITHUB_ENV
echo "envs: ${{ toJson(env) }}"
echo "BRANCH = ${{ env.BRANCH }}"
- name: test1
if: env.BRANCH == 'develop'
shell: brash
run: |
echo "This is develop"
- name: test2
if: env.BRANCH == 'A-511-fix-workflow'
shell: brash
run: |
echo "This is A-511-fix-workflow"