From d59916c45defe654a8289500985ab148997771ba Mon Sep 17 00:00:00 2001 From: asyncapi-bot <61865014+asyncapi-bot@users.noreply.github.com> Date: Thu, 9 Dec 2021 20:01:23 +0100 Subject: [PATCH] ci: update global workflows --- ...umans-add-ready-to-merge-or-do-not-merge-label.yml | 4 ++-- ...for-humans-remove-ready-to-merge-label-on-edit.yml | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml b/.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml index c19c17fc04d..a606fed3a5f 100644 --- a/.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml +++ b/.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml @@ -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 @@ -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 diff --git a/.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml b/.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml index d47cf2fb5d9..3fe91579760 100644 --- a/.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml +++ b/.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml @@ -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' - }) \ No newline at end of file + name: labelToRemove + })