Skip to content

Commit 3477abb

Browse files
authored
chore(ci): auto add pr-backport label (#17189)
1 parent 0465f2e commit 3477abb

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

.github/scripts/check_pr_title.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,33 @@ module.exports = async ({ github, context, core }) => {
1010
const prType = m[1];
1111
// const prScope = m[2];
1212
// const prSummary = title.substring(m[0].length);
13-
let label = "";
13+
let labels = [];
1414
switch (prType) {
1515
case "rfc":
16-
label = "pr-rfc";
16+
labels.push("pr-rfc");
1717
break;
1818
case "feat":
19-
label = "pr-feature";
19+
labels.push("pr-feature");
2020
break;
2121
case "fix":
22-
label = "pr-bugfix";
22+
labels.push("pr-bugfix");
2323
break;
2424
case "refactor":
25-
label = "pr-refactor";
25+
labels.push("pr-refactor");
2626
break;
2727
case "ci":
28-
label = "pr-build";
28+
labels.push("pr-build");
2929
break;
3030
case "docs":
31-
label = "pr-doc";
31+
labels.push("pr-doc");
3232
break;
3333
case "chore":
34-
label = "pr-chore";
34+
labels.push("pr-chore");
3535
break;
3636
}
37+
if (context.payload.pull_request.base.ref.startsWith("backport/")) {
38+
labels.push("pr-backport");
39+
}
3740
await github.rest.issues.addLabels({
3841
owner: context.repo.owner,
3942
repo: context.repo.repo,

0 commit comments

Comments
 (0)