mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-03-12 17:51:46 +08:00
Bumps [actions/github-script](https://github.com/actions/github-script) from 7 to 8. - [Release notes](https://github.com/actions/github-script/releases) - [Commits](https://github.com/actions/github-script/compare/v7...v8) --- updated-dependencies: - dependency-name: actions/github-script dependency-version: '8' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
46 lines
1.4 KiB
YAML
46 lines
1.4 KiB
YAML
name: Label PRs by Type of Change
|
|
|
|
on:
|
|
pull_request_target:
|
|
types: [opened, edited, synchronize]
|
|
|
|
jobs:
|
|
label-pr:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
pull-requests: write
|
|
issues: write
|
|
contents: read # Often needed for github-script
|
|
steps:
|
|
- name: Check PR body for Type of Change
|
|
uses: actions/github-script@v8
|
|
with:
|
|
script: |
|
|
const prBody = context.payload.pull_request.body || '';
|
|
const labelsToAdd = [];
|
|
|
|
if (/\[x\]\s*New feature/i.test(prBody)) {
|
|
labelsToAdd.push('new feature');
|
|
}
|
|
if (/\[x\]\s*Bug fix/i.test(prBody)) {
|
|
labelsToAdd.push('bug');
|
|
}
|
|
if (/\[x\]\s*Documentation update/i.test(prBody)) {
|
|
labelsToAdd.push('documentation');
|
|
}
|
|
if (/\[x\]\s*Hotfix/i.test(prBody)) {
|
|
labelsToAdd.push('hotfix');
|
|
}
|
|
if (/\[x\]\s*UI\/UX improvement/i.test(prBody)) {
|
|
labelsToAdd.push('ui update');
|
|
}
|
|
|
|
if (labelsToAdd.length > 0) {
|
|
await github.rest.issues.addLabels({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: context.payload.pull_request.number,
|
|
labels: labelsToAdd
|
|
});
|
|
}
|