Skip to content

Commit

Permalink
ci: Require upload dates to be valid to schedule package for removal (#…
Browse files Browse the repository at this point in the history
…74)

* To guard against invalid dates being viewed as being older than the
  removal threshold date first check that the upload date is YYYY-MM-DD
  formatted. If not, warn in the logs and skip the offending package.
  • Loading branch information
matthewfeickert authored Mar 1, 2024
1 parent 50053b3 commit 535c72c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/remove-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,17 @@ jobs:
tail --lines 1 | \
awk '{print $1}')
if [[ "${upload_date}" < "${threshold_date}" ]]; then
echo "# ${ANACONDA_USER}/${package_name}/${package_version} last uploaded on ${upload_date}"
echo "${package_version}" >> remove-package-versions.txt
# check upload_date is YYYY-MM-DD formatted
# c.f. https://github.com/scientific-python/upload-nightly-action/issues/73
if [[ "${upload_date}" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]]; then
if [[ "${upload_date}" < "${threshold_date}" ]]; then
echo "# ${ANACONDA_USER}/${package_name}/${package_version} last uploaded on ${upload_date}"
echo "${package_version}" >> remove-package-versions.txt
fi
else
echo "# ERROR: ${ANACONDA_USER}/${package_name}/${package_version} upload date ${upload_date} is not YYYY-MM-DD."
fi
done
if [ -s remove-package-versions.txt ]; then
Expand Down

0 comments on commit 535c72c

Please sign in to comment.