-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a7b3d57
commit ac53994
Showing
1 changed file
with
59 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,65 @@ | ||
name: Auto Label PRs | ||
name: Auto Label PR | ||
|
||
on: | ||
pull_request: | ||
types: [opened, edited, synchronize] | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
label_prs: | ||
label: | ||
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 | ||
}); | ||
} | ||
- uses: actions/labeler@v4 | ||
with: | ||
repo-token: "${{ secrets.GITHUB_TOKEN }}" | ||
configuration-path: .github/labeler.yml | ||
|
||
- name: Label GSSOC | ||
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'] | ||
}) | ||
- name: Label documentation | ||
if: contains(github.event.pull_request.title, 'docs') || contains(github.event.pull_request.body, 'documentation') | ||
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: ['documentation'] | ||
}) | ||
- name: Label enhancement | ||
if: contains(github.event.pull_request.title, 'feature') || contains(github.event.pull_request.body, 'enhancement') | ||
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: ['enhancement'] | ||
}) | ||
- name: Label bug | ||
if: contains(github.event.pull_request.title, 'fix') || contains(github.event.pull_request.body, 'bug') | ||
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: ['bug'] | ||
}) |