diff --git a/.github/workflows/recover_s3_repository.yml b/.github/workflows/recover_s3_repository.yml index 36127eed9..b75675a68 100644 --- a/.github/workflows/recover_s3_repository.yml +++ b/.github/workflows/recover_s3_repository.yml @@ -52,8 +52,18 @@ jobs: python3 -c "from datetime import datetime; datetime.strptime('$datetime', '%m-%d-%Y %H:%M:%S %z')" 2> /dev/null exit_code=$? if [ $exit_code -ne 0 ]; then + echo "Invalid datetime: $datetime" exit 1 fi + + # check that datetime is not in the future + python3 -c "from datetime import datetime; import sys; sys.exit(1) if datetime.strptime('$datetime', '%m-%d-%Y %H:%M:%S %z') >= datetime.now() else sys.exit(0)" + exit_code=$? + if [ $exit_code -ne 0 ]; then + echo "datetime cannot be in the future: $datetime" + exit 1 + fi + echo "DATE_TIME=$datetime" >> $GITHUB_ENV - name: Validate path input does not have leading nor trailing slash