Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 92c8f87

Browse filesBrowse files
committed
build(label_pr.yml): add labels based on new PR title
1 parent a8094ae commit 92c8f87
Copy full SHA for 92c8f87

File tree

1 file changed

+28
-0
lines changed
Filter options

1 file changed

+28
-0
lines changed

‎.github/workflows/label_pr.yml

Copy file name to clipboardExpand all lines: .github/workflows/label_pr.yml
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,31 @@ jobs:
1717
- uses: actions/labeler@v5
1818
with:
1919
configuration-path: .github/labeler.yml
20+
- name: Label based on PR title
21+
uses: actions/github-script@v7
22+
with:
23+
script: |
24+
const title = context.payload.pull_request.title.toLowerCase();
25+
const labels = [];
26+
27+
if (title.includes("fix")) {
28+
labels.push("type: bug");
29+
}
30+
if (title.includes("feat")) {
31+
labels.push("type: feature");
32+
}
33+
if (title.includes("doc")) {
34+
labels.push("type: feature");
35+
}
36+
if (title.includes("refactor")) {
37+
labels.push("type: refactor");
38+
}
39+
40+
if (labels.length > 0) {
41+
await github.rest.issues.addLabels({
42+
owner: context.repo.owner,
43+
repo: context.repo.repo,
44+
issue_number: context.payload.pull_request.number,
45+
labels
46+
});
47+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.