Skip to content

Commit 4f1916e

Browse files
authored
Merge pull request #257 from samyak-aditya/main
Add: "auto-label" GitHub Workflow for Automated Labeling
2 parents 7e87ed3 + e1b248c commit 4f1916e

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

.github/workflows/auto-label.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Auto Label Issue
2+
3+
on:
4+
issues:
5+
types: [opened, reopened, edited]
6+
7+
jobs:
8+
label_issue:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
issues: write
12+
steps:
13+
- name: Label Issue
14+
uses: actions/github-script@v6
15+
with:
16+
github-token: ${{secrets.GITHUB_TOKEN}}
17+
script: |
18+
const issue = context.payload.issue;
19+
const issueBody = issue.body ? issue.body.toLowerCase() : '';
20+
const issueTitle = issue.title.toLowerCase();
21+
22+
// Add gssoc label to all issues
23+
await github.rest.issues.addLabels({
24+
owner: context.repo.owner,
25+
repo: context.repo.repo,
26+
issue_number: issue.number,
27+
labels: ['gssoc-ext','hacktoberfest-accepted','hacktoberfest']
28+
});
29+
const addLabel = async (label) => {
30+
await github.rest.issues.addLabels({
31+
owner: context.repo.owner,
32+
repo: context.repo.repo,
33+
issue_number: issue.number,
34+
labels: [label]
35+
});
36+
};

0 commit comments

Comments
 (0)