-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test: add check token job * fix: modify the actual secret jwt name * fix: format the check token * fix: checkout sh file * test: change to workflow_call * fix: format to use workflow_call * fix: use different variable name for broker * fix: convert input to env in workflow_call * fix: only pass secrets in workflow_call * fix: secrets inherit * fix: add secrets in workflow_call * fix: use secrets in workflow_call * fix: no type for secrets * fix: use inputs and secrets directly in workflow_call * feat: use composer to generate pipelines * fix: remove sh script
- Loading branch information
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Check token expiration | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
url: | ||
description: "The Broker URL" | ||
default: https://broker.io.nrs.gov.bc.ca | ||
type: string | ||
secrets: | ||
token: | ||
description: "The Broker token" | ||
required: true | ||
|
||
jobs: | ||
check-jwt: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check token expiration | ||
shell: bash | ||
run: | | ||
RESPONSE_CODE=$(curl -o /dev/null -s -w "%{http_code}" -X 'GET' \ | ||
${{ inputs.url }}/v1/health/token-check \ | ||
-H 'accept: */*' \ | ||
-H 'Authorization: Bearer '"${{ secrets.token }}"'' \ | ||
) | ||
if [ "$RESPONSE_CODE" -eq 401 ]; then | ||
echo "Unauthorized (401)" | ||
exit 1 | ||
elif [ "$RESPONSE_CODE" -eq 403 ]; then | ||
echo "Invalid JWT: Block list has match" | ||
exit 1 | ||
else | ||
echo "Response code: $RESPONSE_CODE" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters