From 6086bd0f33f1b97477876039726e4171ecf32b6a Mon Sep 17 00:00:00 2001 From: fauxbytes Date: Thu, 10 Nov 2022 20:49:33 +0200 Subject: [PATCH 1/4] github.base_ref --- .github/workflows/tests.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c8acf2d..f8131ec 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,5 +20,19 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} + - run: | + echo "target branch: ${{ github.base_ref }}" +# if [ "${{ github.base_ref }}" = "refs/heads/test" ]; then +# echo "::set-output name=env_name::canvas-test" +# elif [ "${{ github.base_ref }}" = "refs/heads/development" ]; then +# echo "::set-output name=env_name::canvas-dev" +# elif [ "${{ github.base_ref }}" = "refs/heads/staging" ]; then +# echo "::set-output name=env_name::canvas-staging" +# elif [ "${{ github.base_ref }}" = "refs/heads/master" ]; then +# echo "::set-output name=env_name::canvas-prod" +# else +# echo "::set-output name=env_name::not-found" +# fi + - run: npm ci - run: npm test From 5b4c0fe0c3f14b0d6a1b0124773cd6d5eff4af83 Mon Sep 17 00:00:00 2001 From: fauxbytes Date: Thu, 10 Nov 2022 21:14:12 +0200 Subject: [PATCH 2/4] github.base_ref --- .github/workflows/tests.yml | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f8131ec..724b121 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,19 +20,24 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - - run: | + - name: set env + id: set-env + run: | echo "target branch: ${{ github.base_ref }}" -# if [ "${{ github.base_ref }}" = "refs/heads/test" ]; then -# echo "::set-output name=env_name::canvas-test" -# elif [ "${{ github.base_ref }}" = "refs/heads/development" ]; then -# echo "::set-output name=env_name::canvas-dev" -# elif [ "${{ github.base_ref }}" = "refs/heads/staging" ]; then -# echo "::set-output name=env_name::canvas-staging" -# elif [ "${{ github.base_ref }}" = "refs/heads/master" ]; then -# echo "::set-output name=env_name::canvas-prod" -# else -# echo "::set-output name=env_name::not-found" -# fi + if [ "${{ github.base_ref }}" = "test" ]; then + echo "name=env_name::canvas-test" >> $GITHUB_OUTPUT + elif [ "${{ github.base_ref }}" = "dev" ]; then + echo "name=env_name::canvas-dev" >> $GITHUB_OUTPUT + elif [ "${{ github.base_ref }}" = "staging" ]; then + echo "name=env_name::canvas-staging" >> $GITHUB_OUTPUT + elif [ "${{ github.base_ref }}" = "master" ]; then + echo "name=env_name::canvas-prod" >> $GITHUB_OUTPUT + else + echo "name=env_name::not-found" >> $GITHUB_OUTPUT + fi + - name: test env + run: | + echo "output is: ${{steps.set-env.outputs.name}}" - run: npm ci - run: npm test From b22e693d146a60aafdce920b675bd4efb28610f3 Mon Sep 17 00:00:00 2001 From: fauxbytes Date: Thu, 10 Nov 2022 22:07:24 +0200 Subject: [PATCH 3/4] github.base_ref --- .github/workflows/tests.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 724b121..983b01c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,17 +24,14 @@ jobs: id: set-env run: | echo "target branch: ${{ github.base_ref }}" - if [ "${{ github.base_ref }}" = "test" ]; then - echo "name=env_name::canvas-test" >> $GITHUB_OUTPUT - elif [ "${{ github.base_ref }}" = "dev" ]; then - echo "name=env_name::canvas-dev" >> $GITHUB_OUTPUT - elif [ "${{ github.base_ref }}" = "staging" ]; then - echo "name=env_name::canvas-staging" >> $GITHUB_OUTPUT - elif [ "${{ github.base_ref }}" = "master" ]; then - echo "name=env_name::canvas-prod" >> $GITHUB_OUTPUT - else - echo "name=env_name::not-found" >> $GITHUB_OUTPUT - fi + case ${{ github.base_ref }} in + test) v=test ;; + staging) v=staging ;; + master) v=prod ;; + dev) v=dev ;; + *) v=not-found + esac + echo "name=env_name::canvas-$v" >> $GITHUB_OUTPUT - name: test env run: | echo "output is: ${{steps.set-env.outputs.name}}" From afad9bf056f8ed0bd925c5ad941924822fb506a4 Mon Sep 17 00:00:00 2001 From: fauxbytes Date: Thu, 10 Nov 2022 22:31:57 +0200 Subject: [PATCH 4/4] github.base_ref