Skip to content

Commit

Permalink
chore(workflow): skip step rather than cancel job is deploy chromatic
Browse files Browse the repository at this point in the history
Skip steps rather than canceling the entire workflow to avoid cancellation notifications.
  • Loading branch information
gcornut committed Aug 13, 2024
1 parent 93ddd25 commit 1e4cd7e
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions .github/workflows/release-deploy-chromatic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ on:
branches:
- master

permissions:
actions: 'write'

concurrency:
group: chromatic-release-${{ github.head_ref }}
cancel-in-progress: true
Expand All @@ -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 }}
Expand Down

0 comments on commit 1e4cd7e

Please sign in to comment.