mirror of
https://github.com/github/awesome-copilot.git
synced 2026-05-29 10:01:45 +00:00
chore: publish from staged
This commit is contained in:
@@ -3,6 +3,8 @@ name: External Plugin Approval Commands
|
|||||||
on:
|
on:
|
||||||
issue_comment:
|
issue_comment:
|
||||||
types: [created]
|
types: [created]
|
||||||
|
pull_request:
|
||||||
|
types: [closed]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
@@ -13,6 +15,7 @@ jobs:
|
|||||||
handle-command:
|
handle-command:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: >-
|
if: >-
|
||||||
|
github.event_name == 'issue_comment' &&
|
||||||
!github.event.issue.pull_request &&
|
!github.event.issue.pull_request &&
|
||||||
(contains(github.event.comment.body, '/approve') || contains(github.event.comment.body, '/reject'))
|
(contains(github.event.comment.body, '/approve') || contains(github.event.comment.body, '/reject'))
|
||||||
steps:
|
steps:
|
||||||
@@ -407,6 +410,65 @@ jobs:
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sync-merged-pr-labels:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: >-
|
||||||
|
github.event_name == 'pull_request' &&
|
||||||
|
github.event.action == 'closed' &&
|
||||||
|
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
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
- name: Finalize rejection
|
- name: Finalize rejection
|
||||||
if: steps.parse.outputs.should-run == 'true' && steps.parse.outputs.command == 'reject'
|
if: steps.parse.outputs.should-run == 'true' && steps.parse.outputs.command == 'reject'
|
||||||
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
|
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
|
||||||
|
|||||||
Reference in New Issue
Block a user