mirror of
https://github.com/gofiber/fiber.git
synced 2026-03-26 17:48:16 +00:00
49 lines
1.6 KiB
YAML
49 lines
1.6 KiB
YAML
name: Assign v3 project and milestone
|
|
|
|
on:
|
|
issues:
|
|
types:
|
|
- labeled
|
|
pull_request_target:
|
|
types:
|
|
- labeled
|
|
|
|
permissions:
|
|
contents: read
|
|
issues: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
assign-v3:
|
|
if: ${{ github.event.label && github.event.label.name == 'v3' }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Add item to v3 project
|
|
uses: actions/add-to-project@244f685bbc3b7adfa8466e08b698b5577571133e # v1.0.2
|
|
with:
|
|
project-url: https://github.com/orgs/gofiber/projects/1
|
|
github-token: ${{ secrets.ISSUE_PR_TOKEN }}
|
|
- name: Assign v3 milestone
|
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
|
with:
|
|
github-token: ${{ secrets.ISSUE_PR_TOKEN }}
|
|
script: |
|
|
const payload = context.eventName === 'issues' ? context.payload.issue : context.payload.pull_request;
|
|
const issueNumber = payload.number;
|
|
const milestones = await github.paginate(github.rest.issues.listMilestones, {
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
state: 'open',
|
|
per_page: 100,
|
|
});
|
|
const milestone = milestones.find((item) => item.title === 'v3');
|
|
if (!milestone) {
|
|
throw new Error('Milestone "v3" was not found.');
|
|
}
|
|
await github.rest.issues.update({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: issueNumber,
|
|
milestone: milestone.number,
|
|
});
|