From a35d451b67e4cbd2e33a4f63fd7a2fc9a59804c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Fri, 2 Apr 2021 15:31:22 +0200 Subject: [PATCH] Fix PR automation workflow - Use AUTOMATION_TOKEN to get around "resource not available by integration". It looks like jobs triggered from community pull requests do not have permissions to write to our project. - Tolerate the "project already has the associated issue" error for staff as non-fatal. --- .github/workflows/prauto.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/prauto.yml b/.github/workflows/prauto.yml index c6d8ed08c..08d41a99f 100644 --- a/.github/workflows/prauto.yml +++ b/.github/workflows/prauto.yml @@ -9,7 +9,7 @@ jobs: - name: lint pr env: GH_REPO: ${{ github.repository }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.AUTOMATION_TOKEN }} PRID: ${{ github.event.pull_request.node_id }} PRBODY: ${{ github.event.pull_request.body }} PRNUM: ${{ github.event.pull_request.number }} @@ -44,8 +44,14 @@ jobs: if gh api orgs/cli/public_members/$PRAUTHOR --silent 2>/dev/null then - # TODO this errors if it's already on the board... - addToBoard + if ! errtext="$(addToBoard 2>&1)" + then + cat <<<"$errtext" >&2 + if ! grep -iq 'project already has the associated issue' <<<"$errtext" + then + exit 1 + fi + fi exit 0 fi