Skip to content

Commit

Permalink
fix files_changed main merge
Browse files Browse the repository at this point in the history
  • Loading branch information
anadelarosa3 committed Sep 10, 2024
1 parent 517246d commit 8c648a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/android.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
should_run: ${{ steps.check_changes.outputs.run_tests }}
steps:
# Checkout repo to Github Actions runner
# Test change
- name: Checkout
uses: actions/checkout@v4
with:
Expand Down
16 changes: 7 additions & 9 deletions ci/files_changed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ set -euo pipefail
trap 'echo "An unexpected error occurred during file change check."; echo "check_result=1" >> "$GITHUB_OUTPUT"; exit 1' ERR

# Determine the base ref or fallback to HEAD when running on main
# TODO uncomment this is a test for trap
#if [[ -z "${GITHUB_BASE_REF:-}" ]]; then
# echo "GITHUB_BASE_REF is empty, likely running on main branch. Using HEAD~1 for comparison."
# base_ref="HEAD"
#else
# git fetch origin "$GITHUB_BASE_REF":"$GITHUB_BASE_REF"
# base_ref="origin/$GITHUB_BASE_REF"
#fi
if [[ -z "${GITHUB_BASE_REF:-}" ]]; then
echo "GITHUB_BASE_REF is empty, likely running on main branch. Using HEAD for comparison."
base_ref="HEAD"
else
base_ref="origin/$GITHUB_BASE_REF"
fi

if git rev-parse --abbrev-ref HEAD | grep -q ^main$ ; then
echo "Relevant file changes detected!"
Expand All @@ -27,7 +25,7 @@ if git rev-parse --abbrev-ref HEAD | grep -q ^main$ ; then
fi

# Run git diff and store output
diff_output=$(git diff --name-only "origin/$GITHUB_BASE_REF" || exit 1) # Ensure git diff failures are caught
diff_output=$(git diff --name-only "$base_ref" || exit 1) # Ensure git diff failures are caught

# Check for relevant file changes
if echo "$diff_output" | grep -E "$1" ; then
Expand Down

0 comments on commit 8c648a7

Please sign in to comment.