Skip to content

Commit 42d45e1

Browse files
committed
fix(context-ledger): add error handling to prevent script failures
1 parent 47635e4 commit 42d45e1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

action.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,19 @@ runs:
8282
id: check-suggestions
8383
shell: bash
8484
run: |
85+
set +e # Don't exit on error for this section
86+
8587
# Check if the most recent commit is from applying suggestions or only modifies changelog
8688
LATEST_COMMIT_MSG=$(git log -1 --pretty=format:"%s")
8789
echo "Latest commit message: $LATEST_COMMIT_MSG"
8890
8991
# For PRs, check all files changed in the PR, not just the latest commit
9092
if [ "${{ github.event_name }}" == "pull_request" ]; then
9193
echo "Checking all files changed in PR..."
92-
CHANGED_FILES=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }}...HEAD | sort)
94+
# Use git fetch to ensure we have the base ref
95+
git fetch origin ${{ github.event.pull_request.base.ref }} --depth=1 || true
96+
# Use diff-tree to handle both added and deleted files properly
97+
CHANGED_FILES=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }}...HEAD 2>/dev/null | sort || git log --name-only --pretty=format: origin/${{ github.event.pull_request.base.ref }}..HEAD | grep -v '^$' | sort | uniq)
9398
else
9499
# For non-PR events, check the latest commit
95100
CHANGED_FILES=$(git log -1 --name-only --pretty=format: | grep -v '^$' | sort)

0 commit comments

Comments
 (0)