Skip to content

Commit

Permalink
Merge pull request #466 from Anjaliavv51/main
Browse files Browse the repository at this point in the history
Automatic addition od GSSOC , Bug , Enchancement and Documnetation label
  • Loading branch information
PranavBarthwal authored Jul 28, 2024
2 parents e8dddca + 3bcf9cc commit 3897134
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/auto-label-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Auto Label Issues
on:
issues:
types: [opened, edited]

jobs:
label_issues:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
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,
owner: context.repo.owner,
repo: context.repo.name,
labels: labels
});
}
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 3897134

Please sign in to comment.