mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-11-20 00:51:32 -08:00
Add workflow to automatically label pending backports
This commit is contained in:
1 parent
6f97143a0b
commit
d4c3eb359a
1 file changed
+33
@@ -0,0 +1,33 @@
|
||||
name: "Auto-label backport Pull Requests"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [closed]
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
label:
|
||||
if: github.event.pull_request.merged == true
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Add backport-pending label
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const pr = context.payload.pull_request;
|
||||
|
||||
// Match patch releases, e.g. v2.8.1, but not v2.8.0.
|
||||
const milestone = pr.milestone?.title ?? "";
|
||||
const isPatchRelease = /^v\d+\.\d+\.[1-9]\d*$/.test(milestone);
|
||||
|
||||
const labels = pr.labels.map(l => l.name);
|
||||
if (isPatchRelease && !labels.includes("pr: backported") && !labels.includes("pr: backport-queue")) {
|
||||
await github.rest.issues.addLabels({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: pr.number,
|
||||
labels: ["pr: backport-pending"]
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user