From 9360e0af66a40d1f802159e3e1b22fc19f833c39 Mon Sep 17 00:00:00 2001 From: Gran Date: Mon, 24 May 2021 16:28:38 -0700 Subject: [PATCH 1/2] Update test.yml --- .github/workflows/test.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cd011d1..7a6726f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -109,3 +109,22 @@ jobs: # output e.g. : master feat-new-feature v1-0-0 product-1-0-0-rc-2 new-awesome-product echo "Short SHA variables" echo " - ${{ env.GITHUB_SHA_SHORT }}" + + which_branch: + runs-on: ubuntu-latest + steps: + # extract branch name + - name: Extract branch name + if: github.event_name != 'pull_request' + shell: bash + run: echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_REF#refs/heads/})" + id: extract_branch + + # extract branch name on pull request + - name: Print branch name + if: github.event_name == 'pull_request' + run: echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_HEAD_REF})" + + # print branch name + - name: Get branch name + run: echo 'The branch name is' $BRANCH_NAME From 4b91b4b80bcfdd9885488f983416907a273e8771 Mon Sep 17 00:00:00 2001 From: Gran Date: Mon, 24 May 2021 16:36:57 -0700 Subject: [PATCH 2/2] Update test.yml (#104) --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7a6726f..dcca81a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -117,13 +117,13 @@ jobs: - name: Extract branch name if: github.event_name != 'pull_request' shell: bash - run: echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_REF#refs/heads/})" + run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV id: extract_branch # extract branch name on pull request - name: Print branch name if: github.event_name == 'pull_request' - run: echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_HEAD_REF})" + run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF})" >> $GITHUB_ENV # print branch name - name: Get branch name