Skip to content

Commit

Permalink
Merge pull request #8 from Anjaliavv51/code-changes
Browse files Browse the repository at this point in the history
code
  • Loading branch information
Anjaliavv51 authored Jul 29, 2024
2 parents de8a2f8 + 9ac0d84 commit a3fc369
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 22 deletions.
43 changes: 33 additions & 10 deletions .github/workflows/add-gssoc-label-pr.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,43 @@
name: Add GSSOC Label to PR

name: Auto Label PRs
on:
pull_request:
types: [opened]
types: [opened, edited, synchronize]

jobs:
add-label:
label_prs:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["GSSOC"]
})
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
});
}
39 changes: 27 additions & 12 deletions .github/workflows/auto-label-issues.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
name: Add GSSOC Label

name: Auto Label Issues
on:
issues:
types: [opened]

types: [opened, edited]
jobs:
add-label:
label_issues:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["gssoc"]
})
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
});
}

0 comments on commit a3fc369

Please sign in to comment.