Skip to content

Commit

Permalink
wip(github): add composite action to test directory changes and pass/…
Browse files Browse the repository at this point in the history
…exit early
  • Loading branch information
dgrebb committed Apr 22, 2024
1 parent d31e3c1 commit a1a373a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
22 changes: 22 additions & 0 deletions .github/actions/pass-workflow-no-changes/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Pass Workflow and Exit if Directory Unchanged"
description: "If the provided directory has no changes, exit and pass the workflow."
author: dgrebb

inputs:
WORKSPACE_ROOT:
description: "Working Directory"
TEST_DIRECTORY:
description: "The directory to test."

runs:
using: composite
steps:
- name: "Pass if FE has no Changes"
shell: bash
run: |
if git diff --quiet --exit-code ${{ inputs.TEST_DIRECTORY }}; then
echo "No changes found in ${{ inputs.TEST_DIRECTORY }} — exiting workflow."
exit 0
else
echo "Changes detected in the directory."
fi
13 changes: 5 additions & 8 deletions .github/workflows/test-backstop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,11 @@ jobs:
_ci
front
- name: "Pass if FE has no Changes"
run: |
if git diff --quiet --exit-code front; then
echo "No frontend changes — exiting workflow."
exit 0
else
echo "Changes detected in the directory."
fi
- name: 🎫 Pass Early
uses: ./.github/actions/install-cache-deps
with:
WORKSPACE_ROOT: .
TEST_DIRECTORY: front

- name: 🛢 Install Dependencies
uses: ./.github/actions/install-cache-deps
Expand Down

0 comments on commit a1a373a

Please sign in to comment.