diff --git a/.github/actions/pass-workflow-no-changes/action.yml b/.github/actions/pass-workflow-no-changes/action.yml new file mode 100644 index 00000000..b9b4c07c --- /dev/null +++ b/.github/actions/pass-workflow-no-changes/action.yml @@ -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 diff --git a/.github/workflows/test-backstop.yml b/.github/workflows/test-backstop.yml index f57166f4..b84d1b69 100644 --- a/.github/workflows/test-backstop.yml +++ b/.github/workflows/test-backstop.yml @@ -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