Files
awesome-copilot/.github/workflows/external-plugin-approval-command.yml
T
Aaron Powell 517be706aa Fix external plugin command concurrency issues (#1958)
* Separate re-review commands from intake/approval pipeline

- Removed /re-review-* from external-plugin-command-router.yml
- Created external-plugin-rereview-command.yml with separate concurrency
- Each pipeline maintains independent per-issue serialization
  - Router: /approve, /reject, /mark-ready-for-review, /rerun-intake
  - Re-review: /re-review-keep, /re-review-needs-changes, /re-review-remove

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Scope router workflow token permissions

- Set default router workflow permissions to contents:read + issues:write
- Move elevated contents/pull-requests write permissions to approval-command only
- Keep approval command behavior unchanged while reducing privileges for rerun-intake and mark-ready paths

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Align router concurrency with intake workflow

- Update command router to reuse the intake concurrency group key
- Preserve queueing behavior for comment commands

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-06-10 15:14:57 +10:00

71 lines
2.2 KiB
YAML

name: External Plugin Approval Commands
on:
pull_request:
types: [closed]
concurrency:
group: external-plugin-approval-pr-${{ github.event.pull_request.number }}
cancel-in-progress: false
permissions:
issues: write
jobs:
sync-merged-pr-labels:
runs-on: ubuntu-latest
if: >-
github.event.pull_request.merged == true &&
contains(github.event.pull_request.labels.*.name, 'external-plugin')
steps:
- name: Normalize merged external plugin PR labels
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
with:
script: |
const prNumber = context.payload.pull_request.number;
const staleLabels = ['awaiting-review', 'awaiting-approval', 'ready-for-review', 'rejected'];
try {
await github.rest.issues.createLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: 'approved',
color: '1D76DB',
description: 'Submission was approved by a maintainer'
});
} catch (error) {
if (error.status !== 422) {
throw error;
}
}
const { data: currentLabels } = await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
per_page: 100
});
const labelNames = new Set(currentLabels.map((label) => label.name));
if (!labelNames.has('approved')) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
labels: ['approved']
});
}
for (const labelName of staleLabels) {
if (!labelNames.has(labelName)) {
continue;
}
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
name: labelName
});
}