-
-
Notifications
You must be signed in to change notification settings - Fork 208
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
ecb0e3e
commit 3cef369
Showing
1 changed file
with
43 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: "Bug Fix label" | ||
on: | ||
pull_request_target: | ||
types: [ opened,edited ] | ||
jobs: | ||
assign-label: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
issues: write | ||
pull-requests: write | ||
contents: read | ||
steps: | ||
- name: label | ||
env: | ||
TITLE: ${{ github.event.pull_request.title }} | ||
LABEL: Bug Fix - Sooner than Very Soon | ||
uses: actions/github-script@v7 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN}} | ||
script: | | ||
if(process.env.TITLE.split(":")[0].toUpperCase().includes("FIX")){ | ||
github.rest.issues.addLabels({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
labels: [process.env.LABEL] | ||
}) | ||
}else{ | ||
const {data} = await github.rest.issues.listLabelsOnIssue({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
}) | ||
const filtered = data.filter(label => label.name == process.env.LABEL) | ||
if(filtered.length == 1){ | ||
github.rest.issues.removeLabel({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
name: process.env.LABEL | ||
}) | ||
} | ||
} |