From 8f5f31d6f90cd9bef39925c5a5cbadc1711906e7 Mon Sep 17 00:00:00 2001 From: Deniz Cengiz <48965855+dnzxy@users.noreply.github.com> Date: Sat, 27 Apr 2024 00:24:23 +0200 Subject: [PATCH] Change GITHUB_TOKEN to user-created GH_PAT Fixes permission issues where GH api responds with: ```swift gh: Resource not accessible by integration (HTTP 403) {"message":"Resource not accessible by integration","documentation_url":"https://docs.github.com/rest/git/refs#create-a-reference"} Error: Process completed with exit code 1. ``` because the default, auto-created GITHUB_TOKEN cannot be given appropriate content write permissions to create branches in the owner's repository --- .github/workflows/build_loop.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_loop.yml b/.github/workflows/build_loop.yml index 3695fc053..2e23da16a 100644 --- a/.github/workflows/build_loop.yml +++ b/.github/workflows/build_loop.yml @@ -53,7 +53,7 @@ jobs: - name: Check for alive branch if: steps.workflow-permission.outputs.has_permission == 'true' env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GH_PAT }} run: | if [[ "$(gh api -H "Accept: application/vnd.github+json" /repos/${{ github.repository_owner }}/LoopWorkspace/branches | jq --raw-output 'any(.name=="alive")')" == "true" ]]; then echo "Branch 'alive' exists." @@ -66,7 +66,7 @@ jobs: - name: Create alive branch if: env.ALIVE_BRANCH_EXISTS == 'false' env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GH_PAT }} run: | # Get ref for LoopKit/LoopWorkspace:dev SHA=$(curl -sS https://api.github.com/repos/${{ env.UPSTREAM_REPO }}/git/refs \