Skip to content

Set max branch limit to 10 and enable deletion on scheduled runs#24064

Merged
pelikhan merged 2 commits intomainfrom
copilot/set-max-branch-limit-to-10
Apr 2, 2026
Merged

Set max branch limit to 10 and enable deletion on scheduled runs#24064
pelikhan merged 2 commits intomainfrom
copilot/set-max-branch-limit-to-10

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 2, 2026

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_branches default: 110 (input default + MAX_BRANCHES fallback in both steps)
  • "Execute deletion commands" step: added || github.event_name == 'schedule' — deletion now runs automatically on the daily cron, not only when manually triggered with delete_branches: true
  • "Preview mode notice" step: added && github.event_name != 'schedule' — suppresses the preview notice on scheduled runs where deletion is actually performed

Copilot AI and others added 2 commits April 2, 2026 11:16
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>
@pelikhan pelikhan marked this pull request as ready for review April 2, 2026 11:19
Copilot AI review requested due to automatic review settings April 2, 2026 11:19
@pelikhan pelikhan merged commit 114013d into main Apr 2, 2026
1 check passed
@pelikhan pelikhan deleted the copilot/set-max-branch-limit-to-10 branch April 2, 2026 11:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_branches default from 1 → 10 and update the workflow’s MAX_BRANCHES fallback accordingly.
  • Allow deletion to run automatically on schedule events, and suppress the preview-only notice for scheduled runs.
  • Add input-based discriminators to conclusion job concurrency groups in two .lock.yml workflows.

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 eval on strings derived from branch names. Git ref names can legally contain shell metacharacters (e.g., ;), so a maliciously named copilot/* branch could turn this into command injection. Avoid eval: parse the branch name and call git push origin --delete -- "$branch" (or validate with git 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.

Comment on lines 73 to 80
- 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

Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 901 to 903
concurrency:
group: "gh-aw-conclusion-stale-repo-identifier"
group: "gh-aw-conclusion-stale-repo-identifier-${{ inputs.organization || github.run_id }}"
cancel-in-progress: false
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Comment on lines 887 to 889
concurrency:
group: "gh-aw-conclusion-slide-deck-maintainer"
group: "gh-aw-conclusion-slide-deck-maintainer-${{ inputs.focus || github.run_id }}"
cancel-in-progress: false
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants