Skip to content

Commit

Permalink
Merge pull request #1061 from Anjaliavv51/label
Browse files Browse the repository at this point in the history
Auto Label Added
  • Loading branch information
varshith257 authored Jul 29, 2024
2 parents 5b37b06 + 80b1834 commit 4a4bd21
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 6 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/auto-label-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,19 @@ jobs:
const issue = context.payload.issue;
const title = issue.title.toLowerCase();
const body = issue.body.toLowerCase();
const labels = [];
if (title.includes('gssoc') || body.includes('gssoc')) {
labels.push('GSSoC');
}
if (title.includes('enhancement') || body.includes('enhancement')) {
labels.push('Enhancement');
}
if (title.includes('bug') || body.includes('bug')) {
labels.push('Bug');
}
if (title.includes('documentation') || body.includes('documentation')) {
labels.push('Documentation');
}
if (labels.length > 0) {
github.rest.issues.addLabels({
issue_number: context.issue.number,
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/auto-label-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Auto Label PRs
on:
pull_request:
types: [opened, edited, synchronize]

jobs:
label_prs:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const pr = context.payload.pull_request;
const title = pr.title.toLowerCase();
const body = pr.body ? pr.body.toLowerCase() : '';
const labels = [];
if (title.includes('gssoc') || body.includes('gssoc')) {
labels.push('GSSoC');
}
if (title.includes('enhancement') || body.includes('enhancement')) {
labels.push('Enhancement');
}
if (title.includes('bug') || body.includes('bug')) {
labels.push('Bug');
}
if (title.includes('documentation') || body.includes('documentation')) {
labels.push('Documentation');
}
if (labels.length > 0) {
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.name,
labels: labels
});
}

0 comments on commit 4a4bd21

Please sign in to comment.