From 337b85a2d31f58fd14bee839406e63d2ee70e736 Mon Sep 17 00:00:00 2001 From: Mariusz Kliber <54978452+fossjunkie@users.noreply.github.com> Date: Wed, 30 Nov 2022 15:48:15 +0000 Subject: [PATCH] Apply suggestions from aibaars Co-authored-by: Arthur Baars --- .github/workflows/internal-ci-checks.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/internal-ci-checks.yml b/.github/workflows/internal-ci-checks.yml index e6017b7a3c2..10fac1c8636 100644 --- a/.github/workflows/internal-ci-checks.yml +++ b/.github/workflows/internal-ci-checks.yml @@ -12,17 +12,17 @@ jobs: - name: Set a label to trigger internal CI checks env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + USERNAME: ${{ github.event.pull_request.user.login }} + PR_NUMBER: ${{ github.event.pull_request.number }} + LABEL: "ready-for-internal-ci" run: | - USERNAME="${{ github.event.pull_request.user.login }}" - LABEL="ready-for-internal-ci" set +eo pipefail echo "Checking if user $USERNAME is a member of the CodeQL team" - gh api -H "Accept: application/vnd.github+json" /orgs/github/teams/codeql/memberships/$USERNAME > /dev/null 2>&1 - if [ "$?" == 0 ]; then + if [ "$(gh api "/orgs/github/teams/codeql/memberships/$USERNAME" --jq .state)" == "active" ]; then echo "User $USERNAME is a member of the CodeQL team" - echo "Adding 'ready-for-internal-ci' label" - gh pr edit "${{ github.event.pull_request.number }}" --repo $GITHUB_REPOSITORY --add-label $LABEL + echo "Adding '${LABEL}' label" + gh pr edit "${PR_NUMBER}" --repo "$GITHUB_REPOSITORY" --add-label "$LABEL" else echo "User $USERNAME is not a member of the CodeQL team" - echo "To trigger the internal CI, a maintainer needs to add the ready-for-internal-ci label" + echo "To trigger the internal CI, a maintainer needs to add the '${LABEL}' label" fi \ No newline at end of file