File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 77
88jobs :
99 determine-date :
10- name : Release buildpacks on 2nd and 4th Thursday of the month
10+ name : Release buildpacks on 2nd and last Thursdays of the month
1111 runs-on : ubuntu-22.04
1212 outputs :
1313 should_run : ${{ steps.should_run.outputs.bool }}
@@ -20,14 +20,16 @@ jobs:
2020 echo "bool=true" >> "${GITHUB_OUTPUT}"
2121 else
2222 day_of_month=$(date +%d)
23- # Check if it's the second or fourth Thursday of the month
23+ last_day_cutoff=$(expr $(date -d "-$(date +%d) days month" +%d) - 6)
24+ # Check if it's the second or last Thursday of the month
2425 # second thursday of the month will always be between day 8 and 14 (inclusive)
2526 if [[ "$day_of_month" -ge "8" && "$day_of_month" -le "14" ]]; then
2627 echo "It's the second Thursday of the month"
2728 echo "bool=true" >> "${GITHUB_OUTPUT}"
28- # fourth thursday of the month will always be between day 21 and 28 (inclusive)
29- elif [[ "$day_of_month" -ge "22" && "$day_of_month" -le "28" ]]; then
30- echo "It's the fourth Thursday of the month"
29+ # last thursday of the month will always be within 6 days of the last day of the month
30+ # $last_day_cutoff=(# days in this month - 6)
31+ elif [[ "$day_of_month" -ge "$last_day_cutoff" ]]; then
32+ echo "It's the last Thursday of the month"
3133 echo "bool=true" >> "${GITHUB_OUTPUT}"
3234 else
3335 echo "It's another Thursday of the month"
You can’t perform that action at this time.
0 commit comments