aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/label-bug-fix.yml
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2024-07-11 16:10:02 +0200
committerGitHub <noreply@github.com>2024-07-11 16:10:02 +0200
commit3cef369db331d956889a1382d41746e6d9a5e3e0 (patch)
treeee11d52f52cf706d499a6aab21972fcb1fddf812 /.github/workflows/label-bug-fix.yml
parentecb0e3e7cca8dffcdfd187499fb4beb1bdc5f0bf (diff)
downloadskyhanni-3cef369db331d956889a1382d41746e6d9a5e3e0.tar.gz
skyhanni-3cef369db331d956889a1382d41746e6d9a5e3e0.tar.bz2
skyhanni-3cef369db331d956889a1382d41746e6d9a5e3e0.zip
Internal: Bug fix label (#2203)
Diffstat (limited to '.github/workflows/label-bug-fix.yml')
-rw-r--r--.github/workflows/label-bug-fix.yml43
1 files changed, 43 insertions, 0 deletions
diff --git a/.github/workflows/label-bug-fix.yml b/.github/workflows/label-bug-fix.yml
new file mode 100644
index 000000000..37e2296a9
--- /dev/null
+++ b/.github/workflows/label-bug-fix.yml
@@ -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
+ })
+ }
+ }