Skip to content

chore(deps): update dependency @vueuse/core to v11 - autoclosed #32

chore(deps): update dependency @vueuse/core to v11 - autoclosed

chore(deps): update dependency @vueuse/core to v11 - autoclosed #32

Workflow file for this run

name: Label PR
on:
pull_request_target:
types:
- opened
branches:
- main
jobs:
add-pr-labels:
name: Add PR labels
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
env:
PULL_REQUEST_TITLE: ${{ github.event.pull_request.title }}
with:
script: |
const labelsToAdd = []
const pullRequest = {
number: ${{ github.event.pull_request.number }},
title: process.env.PULL_REQUEST_TITLE,
labelsNames: ${{ toJson(github.event.pull_request.labels.*.name) }}
}
// Select label based on the type in PR title
const pullRequestTypeToLabelName = {
breaking: 'breaking',
feat: 'feature',
fix: 'bug',
build: 'build',
ci: 'ci',
docs: 'documentation',
enhancement: 'enhancement',
chore: 'dependencies',
perf: 'performance',
style: 'style',
test: 'test',
refactor: 'refactor',
revert: 'revert'
}
for (const [pullRequestType, labelName] of Object.entries(
pullRequestTypeToLabelName
)) {
if (
pullRequest.title.startsWith(pullRequestType) &&
!pullRequest.labelsNames.includes(
pullRequestTypeToLabelName[pullRequestType]
)
) {
labelsToAdd.push(labelName)
break
}
}
// Add selected labels
if (labelsToAdd.length > 0) {
github.rest.issues.addLabels({
issue_number: pullRequest.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: labelsToAdd
})
}