Skip to content

Commit

Permalink
check validity
Browse files Browse the repository at this point in the history
  • Loading branch information
GogiPuttar committed Aug 16, 2024
1 parent f1d6f36 commit dca92af
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/check-token-validity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Check Token Validity

on:
push:
branches:
- gogiputtar/testing_github_actions
# workflow_dispatch: # Allows you to manually trigger the workflow

jobs:
check-token:
runs-on: ubuntu-latest

steps:
- name: Check if token is valid
run: |
RESPONSE=$(curl -H "Authorization: token ${{ secrets.OTHER_REPO_PAT }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/user)
if echo "$RESPONSE" | grep -q "Bad credentials"; then
echo "Invalid Token"
exit 1
else
echo "Token is valid"
fi

0 comments on commit dca92af

Please sign in to comment.