From 05adf679bae26a74e1313235f77ceaac9de10b1f Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 25 Nov 2021 03:09:52 +0800 Subject: [PATCH 1/2] initial test --- entrypoint.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 0fef7df..130aea0 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -7,6 +7,11 @@ check_credentials() { if [ -z "$INPUT_CREDENTIAL" ]; then echo "Missing credential" exit 1 + EXPIRATION=`echo $INPUT_CREDENTIAL | jq '.expiration'` + NOWTIME=`date +%s` + if [$(($INPUT_CREDENTIAL / 1000 < $NOWTIME))]; then + echo "Your token is expired. Renew your credentials to continue." + exit 1 fi echo "OK" } From dffbb70eeba3d7cbc52020d5afaba44b4f1b97f7 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 25 Nov 2021 03:10:44 +0800 Subject: [PATCH 2/2] fix var --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 130aea0..7bcd055 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -9,7 +9,7 @@ check_credentials() { exit 1 EXPIRATION=`echo $INPUT_CREDENTIAL | jq '.expiration'` NOWTIME=`date +%s` - if [$(($INPUT_CREDENTIAL / 1000 < $NOWTIME))]; then + if [$(($EXPIRATION / 1000 < $NOWTIME))]; then echo "Your token is expired. Renew your credentials to continue." exit 1 fi