1
1
Fork 0
mirror of https://github.com/goreleaser/nfpm synced 2024-05-21 07:06:16 +02:00

chore(ci): auto-assign milestones

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
This commit is contained in:
Carlos A Becker 2021-12-04 17:08:17 -03:00
parent a261112a61
commit 3fd7971506
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940

58
.github/workflows/milestone.yml vendored Normal file
View File

@ -0,0 +1,58 @@
# shamelessly copied from https://github.com/sigstore/cosign/blob/main/.github/workflows/milestone.yaml
name: milestone
on:
pull_request_target:
types: [closed]
branches:
- main
jobs:
milestone:
runs-on: ubuntu-latest
permissions:
actions: none
checks: none
contents: read
deployments: none
issues: write
packages: none
pull-requests: write
repository-projects: none
security-events: none
statuses: none
steps:
- uses: actions/github-script@v4
with:
script: |
if (!context.payload.pull_request.merged) {
console.log('PR was not merged, skipping.');
return;
}
if (!!context.payload.pull_request.milestone) {
console.log('PR has existing milestone, skipping.');
return;
}
milestones = await github.issues.listMilestones({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
sort: 'due_on',
direction: 'asc'
})
if (milestones.data.length === 0) {
console.log('There are no milestones, skipping.');
return;
}
await github.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
milestone: milestones.data[0].number
});