Skip to content

Commit

Permalink
build_loop.yml: authenticate curl by GH_PAT
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornoleh authored Mar 25, 2024
1 parent 5bfa5c1 commit 8a80098
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/build_loop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,19 @@ 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 \
| jq '.[] | select(.ref == "refs/heads/dev" ) | .object.sha' \
| tr -d '"'
);
response=$(curl --request GET \
--url "https://api.github.com/repos/${{ env.UPSTREAM_REPO }}/git/refs/heads/dev" \
--header "Authorization: Bearer $GITHUB_TOKEN" \
--silent)
echo "API Response: $response"
SHA=$(echo "$response" | jq -r '.object.sha')
if [ "$SHA" = "null" ]; then
echo "Error: Unable to retrieve SHA for the dev branch."
exit 1
fi
echo "SHA of dev branch: $SHA";
# Create alive branch based on LoopKit/LoopWorkspace:dev
gh api \
Expand Down

0 comments on commit 8a80098

Please sign in to comment.