Skip to content

Commit 6407e63

Browse files
authored
ci: Exit workflow if nothing changed (#1964)
1 parent 8177d9a commit 6407e63

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

.github/workflows/chromatic.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,17 @@ jobs:
1111
run: yarn
1212
- name: Check if there are changed packages
1313
id: changed-packages
14+
continue-on-error: true
1415
run: |
1516
changed_packages=$(yarn -s lerna ls --since=origin/master --json --loglevel=error)
16-
[[ $changed_packages = "[]" ]] && echo "No packages changed in this branch" && exit 0 || echo "Continuing to Chromatic"
17+
[[ $changed_packages = "[]" ]] && echo "HAS_CHANGES=false" >> $GITHUB_ENV || echo "HAS_CHANGES=true" >> $GITHUB_ENV
1718
- name: Run Build
19+
if: ${{ env.HAS_CHANGES == 'true' }}
1820
shell: bash
1921
run: yarn lerna run build --since=origin/master --include-filtered-dependencies
2022
- name: Publish to Chromatic
2123
uses: chromaui/action@v1
24+
if: ${{ env.HAS_CHANGES == 'true' }}
2225
with:
2326
token: ${{ secrets.GITHUB_TOKEN }}
2427
# 👇 Chromatic projectToken, if you are project maintainer refer to the manage page to obtain it.

.github/workflows/prerelease.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
id: changed-packages
2323
run: |
2424
changed_packages=$(yarn -s lerna ls --since=origin/master --json --loglevel=error)
25-
[[ $changed_packages = "[]" ]] && echo "No packages changed in this branch" && exit 0 || echo "Continuing to prerelease"
25+
[[ $changed_packages = "[]" ]] && echo "No packages changed in this branch" && exit 1 || echo "Continuing to prerelease"
2626
- name: Build all affected packages
2727
run: yarn lerna run build --since=origin/master
2828
- name: Generate prerelease prefix

0 commit comments

Comments
 (0)