Skip to content

Commit

Permalink
Merge pull request #74 from cloudfoundry/release-reminder-date-2
Browse files Browse the repository at this point in the history
Run release reminder on LAST thursday of the month
  • Loading branch information
sophiewigmore authored Mar 4, 2024
2 parents e81a291 + 568f546 commit f4c7fa1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions buildpack/.github/workflows/release-reminder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
determine-date:
name: Release buildpacks on 2nd and 4th Thursday of the month
name: Release buildpacks on 2nd and last Thursdays of the month
runs-on: ubuntu-22.04
outputs:
should_run: ${{ steps.should_run.outputs.bool }}
Expand All @@ -20,14 +20,16 @@ jobs:
echo "bool=true" >> "${GITHUB_OUTPUT}"
else
day_of_month=$(date +%d)
# Check if it's the second or fourth Thursday of the month
last_day_cutoff=$(expr $(date -d "-$(date +%d) days month" +%d) - 6)
# Check if it's the second or last Thursday of the month
# second thursday of the month will always be between day 8 and 14 (inclusive)
if [[ "$day_of_month" -ge "8" && "$day_of_month" -le "14" ]]; then
echo "It's the second Thursday of the month"
echo "bool=true" >> "${GITHUB_OUTPUT}"
# fourth thursday of the month will always be between day 21 and 28 (inclusive)
elif [[ "$day_of_month" -ge "22" && "$day_of_month" -le "28" ]]; then
echo "It's the fourth Thursday of the month"
# last thursday of the month will always be within 6 days of the last day of the month
# $last_day_cutoff=(# days in this month - 6)
elif [[ "$day_of_month" -ge "$last_day_cutoff" ]]; then
echo "It's the last Thursday of the month"
echo "bool=true" >> "${GITHUB_OUTPUT}"
else
echo "It's another Thursday of the month"
Expand Down

0 comments on commit f4c7fa1

Please sign in to comment.