Skip to content

Commit

Permalink
Merge pull request #19 from anadelarosa3/ana-head-1-files-changed
Browse files Browse the repository at this point in the history
Test `HEAD~1`
  • Loading branch information
pablo-guardiola authored Sep 10, 2024
2 parents 86ae8de + 12700a8 commit e27a674
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/android.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
# Checkout repo to Github Actions runner
# Test change
# Test change
# Test change
- name: Checkout
uses: actions/checkout@v4
with:
Expand Down
8 changes: 4 additions & 4 deletions ci/files_changed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ set -euo pipefail
# Trap to handle unexpected errors and log them
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
# Determine the base ref or fallback to HEAD~1 when running on main
if [[ -z "${GITHUB_BASE_REF:-}" ]]; then
echo "GITHUB_BASE_REF is empty, likely running on main branch. Using HEAD for comparison."
base_ref="HEAD"
echo "GITHUB_BASE_REF is empty, likely running on main branch. Using HEAD~1 for comparison."
base_ref="HEAD~1"
else
base_ref="origin/$GITHUB_BASE_REF"
fi

if git rev-parse --abbrev-ref HEAD | grep -q ^main$ ; then
if git rev-parse --abbrev-ref HEAD~1 | grep -q ^main$ ; then
echo "Relevant file changes detected!"
echo "check_result=0" >> "$GITHUB_OUTPUT"
exit 0
Expand Down

0 comments on commit e27a674

Please sign in to comment.