Skip to content

Commit

Permalink
ci: improve removal of ready-to-merge label only when present
Browse files Browse the repository at this point in the history
  • Loading branch information
derberg authored Dec 8, 2021
1 parent 8ac0c47 commit 707cd76
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on: issue_comment

jobs:
parse-comment-and-add-ready: # for handling cases when you want to mark as ready to merge
if: github.event.issue.pull_request && github.event.issue.state != 'closed'
if: github.event.issue.pull_request && github.event.issue.state != 'closed' && github.actor != 'asyncapi-bot'
runs-on: ubuntu-latest
steps:
- name: Check if PR is draft # such info is not available in the context of issue_comment event
Expand All @@ -34,7 +34,7 @@ jobs:
})
parse-comment-and-add-block: # for handling cases when you want to mark as do-not-merge
if: github.event.issue.pull_request && github.event.issue.state != 'closed'
if: github.event.issue.pull_request && github.event.issue.state != 'closed' && github.actor != 'asyncapi-bot'
runs-on: ubuntu-latest
steps:
- name: Add label
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,16 @@ jobs:
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const labelToRemove = 'ready-to-merge';
const labels = context.payload.pull_request.labels;
const isLabelPresent = labels.some(label => label.name === labelToRemove)
if(!isLabelPresent) return;
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'ready-to-merge'
})
name: labelToRemove
})

0 comments on commit 707cd76

Please sign in to comment.