Skip auto-push when workflow files remain staged

This commit is contained in:
Carlos Polop
2026-02-11 15:46:13 +01:00
parent 4650d6b8ad
commit b6c4474c27
2 changed files with 11 additions and 2 deletions

View File

@@ -127,8 +127,13 @@ jobs:
# Avoid workflow-file pushes with token scopes that cannot write workflows.
git reset -- .github/workflows || true
git checkout -- .github/workflows || true
git clean -fd -- .github/workflows || true
git clean -fdx -- .github/workflows || true
git reset -- chack_failure_summary.txt chack_prompt.txt chack_failed_steps_logs.txt
if git diff --cached --name-only | grep -q '^.github/workflows/'; then
echo "Workflow-file changes are still staged; skipping push without workflows permission."
echo "pushed=false" >> "$GITHUB_OUTPUT"
exit 0
fi
if git diff --cached --quiet; then
echo "No committable changes left after filtering."
echo "pushed=false" >> "$GITHUB_OUTPUT"

View File

@@ -184,8 +184,12 @@ jobs:
# Avoid workflow-file pushes with token scopes that cannot write workflows.
git reset -- .github/workflows || true
git checkout -- .github/workflows || true
git clean -fd -- .github/workflows || true
git clean -fdx -- .github/workflows || true
git reset -- chack_failure_summary.txt chack_prompt.txt
if git diff --cached --name-only | grep -q '^.github/workflows/'; then
echo "Workflow-file changes are still staged; skipping push without workflows permission."
exit 0
fi
if git diff --cached --quiet; then
echo "No committable changes left after filtering."
exit 0