From 1c72eb376d7dd896128b98da7bc3d33a09098ca6 Mon Sep 17 00:00:00 2001 From: Niklaus Schen <8458369+Water-Melon@users.noreply.github.com> Date: Wed, 27 Sep 2023 00:16:02 +0800 Subject: [PATCH] chore(ci): automatically label community PRs with author/community (#11659) Remove label from PRs that created by organization members and bots https://konghq.atlassian.net/browse/KAG-2562 --- .github/workflows/label-community-pr.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/label-community-pr.yml b/.github/workflows/label-community-pr.yml index 64cb75bf02e7..b1eb9d1fdda1 100644 --- a/.github/workflows/label-community-pr.yml +++ b/.github/workflows/label-community-pr.yml @@ -19,14 +19,14 @@ jobs: env: GH_TOKEN: ${{ secrets.COMMUNITY_PRS_TOKEN }} LABEL: "author/community" - BOTS: "team-gateway-bot dependabot" + BOTS: "team-gateway-bot app/dependabot" run: | set +e for id in `gh pr list -S 'draft:false' -s 'open'|awk '{print $1}'` do name=`gh pr view $id --json author -q '.author.login'` - gh api orgs/Kong/members --paginate -q '.[].login'|grep -q "^${name}$" - if [[ $? -ne 0 && ! "${BOTS[@]}" =~ $name ]]; then + ret=`gh api orgs/Kong/members --paginate -q '.[].login'|grep "^${name}$"` + if [[ -z $ret && ! "${BOTS[@]}" =~ $name ]]; then gh pr edit $id --add-label "${{ env.LABEL }}" else gh pr edit $id --remove-label "${{ env.LABEL }}"