From 1e4cd7e11efbb92d49dca22648569a5da2cdcac5 Mon Sep 17 00:00:00 2001 From: Guillaume Cornut Date: Tue, 13 Aug 2024 15:01:06 +0200 Subject: [PATCH] chore(workflow): skip step rather than cancel job is deploy chromatic Skip steps rather than canceling the entire workflow to avoid cancellation notifications. --- .../workflows/release-deploy-chromatic.yaml | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release-deploy-chromatic.yaml b/.github/workflows/release-deploy-chromatic.yaml index 0fac9a4f3..fbe897dad 100644 --- a/.github/workflows/release-deploy-chromatic.yaml +++ b/.github/workflows/release-deploy-chromatic.yaml @@ -7,9 +7,6 @@ on: branches: - master -permissions: - actions: 'write' - concurrency: group: chromatic-release-${{ github.head_ref }} cancel-in-progress: true @@ -19,29 +16,30 @@ jobs: name: "Deploy chromatic" runs-on: ubuntu-latest steps: + - name: "Checkout repository" + uses: actions/checkout@v3 + with: + fetch-depth: 0 # retrieve all the repo history (required by chromatic) + - name: "Check is release commit" + id: check env: GH_TOKEN: ${{ github.token }} run: | set -x # verbose - message=$(gh api /repos/${GITHUB_REPOSITORY}/commits/${GITHUB_SHA} --jq .commit.message) + message=$(git show -s --format=%s) - # Commit is not a release commit - if [[ "$message" != 'chore(release): release'* ]]; then - # Cancel current job - gh run cancel -R ${GITHUB_REPOSITORY} ${{ github.run_id }} - gh run watch -R ${GITHUB_REPOSITORY} ${{ github.run_id }} + # Check is release commit + if [[ "$message" == 'chore(release): release'* ]]; then + echo "is_release_commit=true" >> "$GITHUB_OUTPUT" fi - - name: "Checkout repository" - uses: actions/checkout@v3 - with: - fetch-depth: 0 # retrieve all the repo history (required by chromatic) - - name: "Setup" + if: ${{ steps.check.outputs.is_release_commit == 'true' }} uses: ./.github/actions/setup - name: "Deploy chromatic" + if: ${{ steps.check.outputs.is_release_commit == 'true' }} uses: chromaui/action@3f82bf5d065290658af8add6dce946809ee0f923 #v6.1.0 with: token: ${{ secrets.GITHUB_TOKEN }}