Skip to content

Commit

Permalink
fix: pipe logic
Browse files Browse the repository at this point in the history
Signed-off-by: Jason C. Leach <[email protected]>
  • Loading branch information
jleach committed Oct 25, 2024
1 parent e9bb651 commit bd9c443
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/actions/early-exit-check/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@ runs:
using: composite
steps:
- name: Check location of changed files
id: core_files_check
shell: bash
run: |
echo "mango=xx" >> $GITHUB_OUTPUT
exit 0
set -x
if [ "${GITHUB_REF_NAME}" = "main" ]; then
Expand Down
32 changes: 31 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,37 @@ jobs:

- name: Check if core files changed
id: core_files_changed
uses: ./.github/workflows/actions/early-exit-check
shell: bash
run: |
set -x
if [ "${GITHUB_REF_NAME}" = "main" ]; then
# On main branch, compare with the previous
# commit otherwise (for PRs) compare with the
# current commit.
parent_ref="${GITHUB_REF_NAME:-main}^"
child_ref="${GITHUB_SHA}"
else
# On PRs, compare with the base branch.
parent_ref="origin/${GITHUB_BASE_REF:-main}"
child_ref="HEAD"
fi
echo "Comparing ${parent_ref} with ${child_ref}"
diff_output=$(git diff --name-only ${parent_ref}..${child_ref})
# change_count=$(echo "$diff_output" | grep -E '^(app/.*)|(.yarn/.*)|(.github/workflows/.*)' | wc -l | awk '{$1=$1};1' || true)
change_count=$(echo "$diff_output" | grep -E '^(blarb/.*)' | wc -l | awk '{$1=$1};1' || true)
echo "$change_count files changed in app, .yarn, or .github/workflows"
if [ $change_count -gt 0 ]; then
# A result greater than 0 means there are changes
# in the specified directories.
echo "result=zz" >> $GITHUB_OUTPUT
else
echo "result=xx" >> $GITHUB_OUTPUT
fi
- name: xxxxxxx
# if: steps.core_files_changed.outputs.result != 'true'
Expand Down

0 comments on commit bd9c443

Please sign in to comment.