From b6c4474c27e5b79a354048821ecf8fd03c1bc2cd Mon Sep 17 00:00:00 2001 From: Carlos Polop Date: Wed, 11 Feb 2026 15:46:13 +0100 Subject: [PATCH] Skip auto-push when workflow files remain staged --- .github/workflows/ci-master-failure-chack-agent-pr.yml | 7 ++++++- .github/workflows/pr-failure-chack-agent-dispatch.yml | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-master-failure-chack-agent-pr.yml b/.github/workflows/ci-master-failure-chack-agent-pr.yml index d51b23d..da496c0 100644 --- a/.github/workflows/ci-master-failure-chack-agent-pr.yml +++ b/.github/workflows/ci-master-failure-chack-agent-pr.yml @@ -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" diff --git a/.github/workflows/pr-failure-chack-agent-dispatch.yml b/.github/workflows/pr-failure-chack-agent-dispatch.yml index 6555a9b..e2eecb7 100644 --- a/.github/workflows/pr-failure-chack-agent-dispatch.yml +++ b/.github/workflows/pr-failure-chack-agent-dispatch.yml @@ -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