fix(workflows): scheduled cron closes PRs; safe --close strip in triage

Co-authored-by: Yassin Kortam <yassin@berri.ai>
This commit is contained in:
Cursor Agent 2026-05-17 16:37:04 +00:00
parent 483042ef84
commit 4961bf4eaf
No known key found for this signature in database
3 changed files with 24 additions and 7 deletions

View file

@ -62,9 +62,10 @@ jobs:
- name: Run low-quality PR closer
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Default to dry-run for scheduled triggers as well. The repo
# variable AGENT_SHIN_ENABLED must be "true" before scheduled runs
# actually close PRs, AND workflow_dispatch must opt-in via close=true.
# Scheduled runs honor AGENT_SHIN_ENABLED directly: when the repo
# variable is "true", the cron actually closes PRs. workflow_dispatch
# must additionally opt-in via close=true so manual previews stay
# dry-run by default.
CLOSE_FLAG: ${{ github.event.inputs.close || 'false' }}
AGENT_SHIN_ENABLED: ${{ vars.AGENT_SHIN_ENABLED }}
MIN_AGE_DAYS: ${{ github.event.inputs.min_age_days || '7' }}
@ -80,7 +81,7 @@ jobs:
)
if [ "${AGENT_SHIN_ENABLED:-false}" != "true" ]; then
echo "::notice::AGENT_SHIN_ENABLED is not 'true' -> forcing dry-run regardless of close input."
elif [ "${CLOSE_FLAG}" = "true" ]; then
elif [ "${GITHUB_EVENT_NAME:-}" = "schedule" ] || [ "${CLOSE_FLAG}" = "true" ]; then
ARGS+=(--close)
echo "::notice::Running in close-on-fail mode."
else

View file

@ -69,7 +69,15 @@ jobs:
# Automatic `issues` events stay dry-run regardless until the team
# explicitly invokes workflow_dispatch with close=true.
if [ "${GITHUB_EVENT_NAME:-}" = "issues" ]; then
ARGS=("${ARGS[@]/--close/}")
# filter out --close rather than substituting to "" (which would
# leave an empty positional arg that argparse rejects)
FILTERED=()
for arg in "${ARGS[@]}"; do
if [ "${arg}" != "--close" ]; then
FILTERED+=("${arg}")
fi
done
ARGS=("${FILTERED[@]}")
echo "::notice::issues trigger -> forcing dry-run."
fi
python3 .github/scripts/triage_with_llm.py "${ARGS[@]}"

View file

@ -82,8 +82,16 @@ jobs:
# summary before any contributor sees a comment. Only the manual
# workflow_dispatch path (with close=true) closes PRs.
if [ "${GITHUB_EVENT_NAME:-}" = "pull_request_target" ]; then
# strip any --close added above
ARGS=("${ARGS[@]/--close/}")
# strip any --close added above (filter out, don't substitute
# to empty string — that would leave a stray "" positional arg
# that argparse rejects)
FILTERED=()
for arg in "${ARGS[@]}"; do
if [ "${arg}" != "--close" ]; then
FILTERED+=("${arg}")
fi
done
ARGS=("${FILTERED[@]}")
echo "::notice::pull_request_target trigger -> forcing dry-run."
fi
python3 .github/scripts/triage_with_llm.py "${ARGS[@]}"