Skip to content

Commit cb70cdc

Browse files
committed
dbeaver/dbeaver-devops#2023 Add support for GitHub token authentication
in API call
1 parent 7360c40 commit cb70cdc

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

prepare-custom-p2/action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,18 @@ runs:
2525
shell: bash
2626
env:
2727
REPO: ${{ inputs.repo }}
28+
GITHUB_TOKEN: ${{ inputs.token }}
2829
run: |
2930
uri_encoded_branch_name=$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$GITHUB_HEAD_REF")
3031
echo "uri_encoded_branch_name=$uri_encoded_branch_name"
32+
if [ -z "$GITHUB_TOKEN" ]; then
33+
AUTH_HEADER=""
34+
else
35+
AUTH_HEADER="-H Authorization: token $GITHUB_TOKEN"
36+
fi
3137
http_status=$(curl -s -o /dev/null -w "%{http_code}" \
3238
-H "Accept: application/vnd.github.v3+json" \
39+
"$AUTH_HEADER"
3340
"https://api.github.com/repos/$GITHUB_REPOSITORY_OWNER/$REPO/branches/$uri_encoded_branch_name")
3441
echo "httpstatus=$http_status"
3542
if [ "$http_status" = '200' ]; then

0 commit comments

Comments
 (0)