mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
ci: label pull requests based on their target branch (#24468)
This commit is contained in:
parent
ce9e76265e
commit
e95ac78a42
39
.github/workflows/label-pr.yml
vendored
Normal file
39
.github/workflows/label-pr.yml
vendored
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
name: Label PR
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request_target:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- 2.x
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
add-pr-label:
|
||||||
|
name: Add PR label
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
if: github.repository == 'nuxt/nuxt'
|
||||||
|
steps:
|
||||||
|
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const baseName = "${{ github.event.pull_request.base.label }}"
|
||||||
|
const PRNumber = "${{ github.event.pull_request.number }}"
|
||||||
|
|
||||||
|
if(baseName === "nuxt:2.x") {
|
||||||
|
github.rest.issues.addLabels({
|
||||||
|
issue_number: PRNumber,
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
labels: ["2.x"]
|
||||||
|
})
|
||||||
|
} else if(baseName === "nuxt:main") {
|
||||||
|
github.rest.issues.addLabels({
|
||||||
|
issue_number: PRNumber,
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
labels: ["3.x"]
|
||||||
|
})
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user