Skip to content

Commit

Permalink
wip(ci): provide PASS_EARLY output for use as conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrebb committed Apr 23, 2024
1 parent f2aed28 commit a3cd2f0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/actions/pass-early/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,23 @@ inputs:
TEST_DIRECTORY:
description: "The directory to test."

outputs:
PASS_EARLY:
description: "True or false, pass early."
value: ${{ steps.pass-early.outputs.PASS_EARLY }}

runs:
using: composite
steps:
- name: "Pass if FE has no Changes"
id: pass-early
shell: bash
run: |
if git diff --quiet --exit-code ${{ inputs.TEST_DIRECTORY }}; then
echo "No changes found in ${{ inputs.TEST_DIRECTORY }} — exiting workflow."
echo "PASS_EARLY=true" >> $GITHUB_OUTPUT
exit 0
else
echo "PASS_EARLY=false" >> $GITHUB_OUTPUT
echo "Changes detected in the directory."
fi
3 changes: 3 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,19 @@ jobs:
front
- name: 🎫 Pass Early
id: pass-early
uses: ./.github/actions/pass-early
with:
WORKSPACE_ROOT: .
TEST_DIRECTORY: front

- name: 🛢 Install Dependencies
if: ${{ steps.pass-early.outputs.PASS_EARLY = 'false' }}
uses: ./.github/actions/install-cache-deps
with:
WORKSPACE_ROOT: front

- name: 👓 Check
if: ${{ steps.pass-early.outputs.PASS_EARLY = 'false' }}
run: |
cd front && pnpm check && pnpm lint

0 comments on commit a3cd2f0

Please sign in to comment.