Skip to content

feat(archives): open Windows Installer packages (.msi) with their real names #729

feat(archives): open Windows Installer packages (.msi) with their real names

feat(archives): open Windows Installer packages (.msi) with their real names #729

Workflow file for this run

name: Label pull requests

Check warning on line 1 in .github/workflows/label-pr.yml

View workflow run for this annotation

GitHub Actions / Label pull requests

Workflow execution policy warning (evaluate mode)

On December 2, 2026, GitHub will restrict `pull_request_target` on public repositories by default. To continue allowing the event trigger, configure an Actions policy. Learn more: https://gh.io/securely-using-pull_request_target#default-policy-for-pull_request_target
# Labels a new pull request by the files it changes (.github/labeler.yml) and by a Conventional Commits title
# ("feat: ...", "fix(hwp): ..."). Only when it is opened, and labels are only added: labels changed by hand later stay.
#
# pull_request_target runs in this repository with a token that can add labels, also for pull requests from forks. It
# must never check out or run the pull request's code: labeler reads .github/labeler.yml from the base branch and the
# changed file names through the API, and the title is read from the event payload, never put into the script.
on:
pull_request_target:
types: [opened]
permissions: {}
jobs:
label:
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: read # .github/labeler.yml of the base branch
pull-requests: write # add labels
steps:
- uses: actions/labeler@bf12e9b00b37c5c0ca2b87b79b2daf7891dbda13 # v7.0.0
with:
sync-labels: false
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const pull = context.payload.pull_request;
const title = pull.title.toLowerCase();
const rules = [
[/^feat(\(.+\))?!?:/, 'feature'],
[/^fix(\(.+\))?!?:/, 'bug'],
[/^docs(\(.+\))?!?:/, 'documentation'],
[/^(build|ci)(\(.+\))?!?:/, 'build'],
[/^(i18n|l10n)(\(.+\))?!?:/, 'translation'],
];
// Only labels the repository has: adding an unknown name would create a new label.
const known = new Set((await github.paginate(github.rest.issues.listLabelsForRepo, {
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 100,
})).map(label => label.name));
const current = new Set(pull.labels.map(label => label.name));
const labels = rules.filter(([re]) => re.test(title)).map(([, label]) => label)
.filter(label => known.has(label) && !current.has(label));
if (labels.length) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pull.number,
labels,
});
}