Skip to content

Commit

Permalink
Merge pull request #146 from MrChrisW/token-auth
Browse files Browse the repository at this point in the history
Add authentication check
  • Loading branch information
andrii-bodnar committed Nov 2, 2022
2 parents 3290f6b + ec22a49 commit 70f3b47
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ create_pull_request() {

PULLS_URL="${REPO_URL}/pulls"

auth_status=$(curl -sL --write-out '%{http_code}' --output /dev/null -H "${AUTH_HEADER}" -H "${HEADER}" "${PULLS_URL}")
if [[ $auth_status -eq 403 || "$auth_status" -eq 401 ]] ; then
echo "FAILED TO AUTHENTICATE USING 'GITHUB_TOKEN' CHECK TOKEN IS VALID"
exit 1
fi

echo "CHECK IF ISSET SAME PULL REQUEST"

if [ -n "$INPUT_PULL_REQUEST_BASE_BRANCH_NAME" ]; then
Expand Down

0 comments on commit 70f3b47

Please sign in to comment.