Skip to content

Commit

Permalink
Updating github-config
Browse files Browse the repository at this point in the history
  • Loading branch information
cf-buildpacks-eng committed Feb 27, 2024
1 parent db0dc86 commit 788bbc0
Showing 1 changed file with 41 additions and 5 deletions.
46 changes: 41 additions & 5 deletions .github/workflows/release-reminder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,52 @@ name: Release Reminder

on:
schedule:
- cron: '45 0 1 * *'
- cron: '0 0 * * 4' # Run at midnight on Thursdays
workflow_dispatch: {}

jobs:
determine-date:
name: Release buildpacks on 2nd and 4th Thursday of the month
runs-on: ubuntu-22.04
outputs:
should_run: ${{ steps.should_run.outputs.bool }}
steps:
- name: Should run
id: should_run
run: |
if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
echo "Skipping date check, because workflow was run manually"
echo "bool=true" >> "${GITHUB_OUTPUT}"
else
day_of_month=$(date +%d)
# Check if it's the second or fourth 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)
if [[ "$day_of_month" -ge "22" && "$day_of_month" -le "28" ]; then
echo "It's the fourth Thursday of the month"
echo "bool=true" >> "${GITHUB_OUTPUT}"
else
echo "It's another Thursday of the month"
echo "bool=false" >> "${GITHUB_OUTPUT}"
fi
fi
reminder:
name: Reminder
runs-on: ubuntu-22.04
needs: [ determine-date ]
if: ${{ needs.determine-date.outputs.should_run == 'true' }}
steps:
- name: Get Month
id: month
- name: Get Date
id: date
run: |
echo "month=$(date +%b)" >> "${GITHUB_OUTPUT}"
today=$(date +'%m-%d')
window_close_date=$(date -d "+5 days" +'%m-%d')
echo "today=$today" >> "${GITHUB_OUTPUT}"
echo "window_close_date=$window_close_date" >> "${GITHUB_OUTPUT}"
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -40,10 +74,12 @@ jobs:
with:
token: ${{ secrets.CF_BOT_GITHUB_TOKEN }}
repo: ${{ github.repository }}
issue_title: "${{ steps.php-specific.outputs.title }}Release: ${{ github.event.repository.name }} (${{ steps.month.outputs.month }})"
issue_title: "${{ steps.php-specific.outputs.title }}Release: ${{ github.event.repository.name }} (${{ steps.date.outputs.today }})"
issue_body: |
Release reminder for ${{ github.event.repository.name }}
The ideal release date window for this buildpack starts on: ${{ steps.date.outputs.today }} and ends on ${{ steps.date.outputs.window_close_date }}.
${{ steps.php-specific.outputs.task }}
* See [diff from latest version]("https://github.com/${{ github.repository }}/compare/${{ steps.latest-version.outputs.val }}..develop") and validate if a release is required.
* 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 }})
Expand Down

0 comments on commit 788bbc0

Please sign in to comment.