Set max branch limit to 10 and enable deletion on scheduled runs#24064
Set max branch limit to 10 and enable deletion on scheduled runs#24064
Conversation
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/774c0c55-1026-459e-9214-744278987550 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/774c0c55-1026-459e-9214-744278987550 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Enables the scheduled Copilot branch cleanup workflow to actually delete branches (instead of preview-only) and increases the default deletion cap from 1 to 10, plus adjusts concurrency grouping in two gh-aw generated workflows.
Changes:
- Increase
max_branchesdefault from 1 → 10 and update the workflow’sMAX_BRANCHESfallback accordingly. - Allow deletion to run automatically on
scheduleevents, and suppress the preview-only notice for scheduled runs. - Add input-based discriminators to
conclusionjob concurrency groups in two.lock.ymlworkflows.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| .github/workflows/copilot-maintenance.yml | Raises default branch deletion limit and enables scheduled runs to execute deletions. |
| .github/workflows/stale-repo-identifier.lock.yml | Changes conclusion job concurrency group to include an input-based discriminator. |
| .github/workflows/slide-deck-maintainer.lock.yml | Changes conclusion job concurrency group to include an input-based discriminator. |
Comments suppressed due to low confidence (1)
.github/workflows/copilot-maintenance.yml:93
- This step executes deletion commands via
evalon strings derived from branch names. Git ref names can legally contain shell metacharacters (e.g.,;), so a maliciously namedcopilot/*branch could turn this into command injection. Avoideval: parse the branch name and callgit push origin --delete -- "$branch"(or validate withgit check-ref-format) instead.
./scripts/delete-old-copilot-branches.sh | \
grep "git push origin --delete copilot/" | \
while read -r cmd; do
echo "Executing: $cmd"
eval "$cmd" || \
echo "Failed to delete branch (may already be deleted)"
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Run copilot branch cleanup script | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| MAX_BRANCHES: ${{ github.event.inputs.max_branches || '1' }} | ||
| MAX_BRANCHES: ${{ github.event.inputs.max_branches || '10' }} | ||
| run: | | ||
| echo "Running copilot branch cleanup script..." | ||
| ./scripts/delete-old-copilot-branches.sh | ||
|
|
There was a problem hiding this comment.
The scheduled run now executes both “Run copilot branch cleanup script” and “Execute deletion commands”, which calls delete-old-copilot-branches.sh twice. Since the script makes per-branch gh pr list calls, this doubles API usage and runtime on the daily cron and increases the chance of hitting rate limits. Consider skipping the first step when github.event_name == 'schedule' (or when deletion will run), or refactor to run the script once and reuse its output for deletion.
| concurrency: | ||
| group: "gh-aw-conclusion-stale-repo-identifier" | ||
| group: "gh-aw-conclusion-stale-repo-identifier-${{ inputs.organization || github.run_id }}" | ||
| cancel-in-progress: false |
There was a problem hiding this comment.
The PR title/description focuses on Copilot branch cleanup behavior, but this workflow change also modifies concurrency grouping for the stale-repo-identifier conclusion job. If this is intentional, please note it in the PR description (and ideally explain the rationale, e.g., avoiding cross-run contention between different organization inputs).
| concurrency: | ||
| group: "gh-aw-conclusion-slide-deck-maintainer" | ||
| group: "gh-aw-conclusion-slide-deck-maintainer-${{ inputs.focus || github.run_id }}" | ||
| cancel-in-progress: false |
There was a problem hiding this comment.
The PR title/description focuses on Copilot branch cleanup behavior, but this workflow change also modifies concurrency grouping for the slide-deck-maintainer conclusion job. If this is intentional, please note it in the PR description (and ideally explain the rationale, e.g., avoiding cross-run contention between different focus values).
The scheduled copilot branch cleanup was running in preview-only mode and capped at 1 branch. This enables actual deletion on scheduled runs and raises the limit to 10.
Changes
max_branchesdefault:1→10(input default +MAX_BRANCHESfallback in both steps)|| github.event_name == 'schedule'— deletion now runs automatically on the daily cron, not only when manually triggered withdelete_branches: true&& github.event_name != 'schedule'— suppresses the preview notice on scheduled runs where deletion is actually performed