Skip to content

Commit 5b9ac9e

Browse files
Updating github-config (#888)
1 parent db0dc86 commit 5b9ac9e

1 file changed

Lines changed: 41 additions & 5 deletions

File tree

.github/workflows/release-reminder.yml

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,52 @@ name: Release Reminder
22

33
on:
44
schedule:
5-
- cron: '45 0 1 * *'
5+
- cron: '0 0 * * 4' # Run at midnight on Thursdays
66
workflow_dispatch: {}
77

88
jobs:
9+
determine-date:
10+
name: Release buildpacks on 2nd and 4th Thursday of the month
11+
runs-on: ubuntu-22.04
12+
outputs:
13+
should_run: ${{ steps.should_run.outputs.bool }}
14+
steps:
15+
- name: Should run
16+
id: should_run
17+
run: |
18+
if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
19+
echo "Skipping date check, because workflow was run manually"
20+
echo "bool=true" >> "${GITHUB_OUTPUT}"
21+
else
22+
day_of_month=$(date +%d)
23+
# Check if it's the second or fourth Thursday of the month
24+
# second thursday of the month will always be between day 8 and 14 (inclusive)
25+
if [[ "$day_of_month" -ge "8" && "$day_of_month" -le "14" ]; then
26+
echo "It's the second Thursday of the month"
27+
echo "bool=true" >> "${GITHUB_OUTPUT}"
28+
# fourth thursday of the month will always be between day 21 and 28 (inclusive)
29+
if [[ "$day_of_month" -ge "22" && "$day_of_month" -le "28" ]; then
30+
echo "It's the fourth Thursday of the month"
31+
echo "bool=true" >> "${GITHUB_OUTPUT}"
32+
else
33+
echo "It's another Thursday of the month"
34+
echo "bool=false" >> "${GITHUB_OUTPUT}"
35+
fi
36+
fi
937
reminder:
1038
name: Reminder
1139
runs-on: ubuntu-22.04
40+
needs: [ determine-date ]
41+
if: ${{ needs.determine-date.outputs.should_run == 'true' }}
1242
steps:
13-
- name: Get Month
14-
id: month
43+
- name: Get Date
44+
id: date
1545
run: |
16-
echo "month=$(date +%b)" >> "${GITHUB_OUTPUT}"
46+
today=$(date +'%m-%d')
47+
window_close_date=$(date -d "+5 days" +'%m-%d')
48+
49+
echo "today=$today" >> "${GITHUB_OUTPUT}"
50+
echo "window_close_date=$window_close_date" >> "${GITHUB_OUTPUT}"
1751
1852
- name: Checkout
1953
uses: actions/checkout@v3
@@ -40,10 +74,12 @@ jobs:
4074
with:
4175
token: ${{ secrets.CF_BOT_GITHUB_TOKEN }}
4276
repo: ${{ github.repository }}
43-
issue_title: "${{ steps.php-specific.outputs.title }}Release: ${{ github.event.repository.name }} (${{ steps.month.outputs.month }})"
77+
issue_title: "${{ steps.php-specific.outputs.title }}Release: ${{ github.event.repository.name }} (${{ steps.date.outputs.today }})"
4478
issue_body: |
4579
Release reminder for ${{ github.event.repository.name }}
4680
81+
The ideal release date window for this buildpack starts on: ${{ steps.date.outputs.today }} and ends on ${{ steps.date.outputs.window_close_date }}.
82+
4783
${{ steps.php-specific.outputs.task }}
4884
* See [diff from latest version]("https://github.com/${{ github.repository }}/compare/${{ steps.latest-version.outputs.val }}..develop") and validate if a release is required.
4985
* Make sure the latest commit on `develop` has passed tests on the [CI](https://buildpacks.ci.cf-app.com/teams/main/pipelines/${{ github.event.repository.name }})

0 commit comments

Comments
 (0)