Skip to content

Commit

Permalink
validate date is in the past
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenruizdegauna committed Jan 14, 2025
1 parent 63d39cc commit 4d56cbb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/recover_s3_repository.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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()"
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
Expand Down

0 comments on commit 4d56cbb

Please sign in to comment.