From 9e321a92fc3ee83cf3c3cd8f027c28593f3f1484 Mon Sep 17 00:00:00 2001 From: F-G Fernandez <26927750+frgfm@users.noreply.github.com> Date: Wed, 27 Mar 2024 02:35:46 +0100 Subject: [PATCH] ci(github): fix PR label check --- .github/workflows/pr-labels.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml index 49f5f27..36c23c8 100644 --- a/.github/workflows/pr-labels.yml +++ b/.github/workflows/pr-labels.yml @@ -9,14 +9,19 @@ jobs: is-properly-labeled: if: github.event.pull_request.merged == true runs-on: ubuntu-latest + permissions: + pull-requests: write + issues: write steps: - - uses: actions/checkout@v4 - uses: actions/setup-python@v5 - name: Install requests run: pip install requests + - uses: actions/checkout@v4 - name: Process commit and find merger responsible for labeling id: commit - run: echo "::set-output name=merger::$(python .github/verify_labels.py ${{ github.event.pull_request.number }})" + run: | + MERGER=$(python .github/verify_labels.py ${{ github.event.pull_request.number }}) + echo "merger=${MERGER}" | tee --append $GITHUB_OUTPUT - name: Comment PR uses: actions/github-script@v7 if: ${{ steps.commit.outputs.merger != '' }} @@ -24,4 +29,9 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} script: | const { issue: { number: issue_number }, repo: { owner, repo } } = context; - github.issues.createComment({ issue_number, owner, repo, body: 'Hey ${{ steps.commit.outputs.merger }} 👋\nYou merged this PR, but it is not correctly labeled. The list of valid labels is available at https://github.com/quack-ai/companion/blob/main/.github/verify_labels.py' }); + github.rest.issues.createComment({ + issue_number, + owner, + repo, + body: 'Hey ${{ steps.commit.outputs.merger }} 👋\nYou merged this PR, but it is not correctly labeled. The list of valid labels is available at https://github.com/quack-ai/contribution-api/blob/main/.github/verify_labels.py' + });