2023-10-05 08:32:19 +00:00
|
|
|
name: Send a Slack notification when a PR contains rest api changes
|
2023-10-05 09:21:27 +00:00
|
|
|
|
2023-10-05 08:32:19 +00:00
|
|
|
on:
|
|
|
|
pull_request_target:
|
|
|
|
types: [labeled]
|
|
|
|
|
|
|
|
permissions: {}
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
send-slack-notification-when-pr-contains-rest-api-changes:
|
|
|
|
if: "${{ github.event.label.name == 'contains: rest api change' && (github.event.pull_request.state == 'open' || github.event.pull_request.merged) }}"
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
|
|
|
- name: Wait 2 minutes for other labelling jobs to finish
|
2024-08-28 18:08:19 +00:00
|
|
|
run: sleep 2m
|
2023-10-05 08:32:19 +00:00
|
|
|
shell: bash
|
2023-10-09 15:54:59 +00:00
|
|
|
|
2024-05-11 20:14:06 +00:00
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2023-10-09 15:54:59 +00:00
|
|
|
- name: Calculate test date
|
|
|
|
id: calculate_date
|
|
|
|
run: |
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Get the day of the week of the merged PR (0 for Sunday, 1 for Monday, etc.)
|
|
|
|
MERGE_DAY_OF_WEEK=$(date -u -d "${{ github.event.pull_request.merged_at }}" +"%u")
|
|
|
|
|
|
|
|
# Calculate days until the next Thursday after the merge
|
|
|
|
# If the merge is on Thursday, this will give 7 (i.e., next week's Thursday)
|
|
|
|
DAYS_UNTIL_NEXT_THURSDAY=$(( (4 + 7 - MERGE_DAY_OF_WEEK) % 7 ))
|
|
|
|
|
|
|
|
# If DAYS_UNTIL_NEXT_THURSDAY is 0, the merge was on a Thursday, so we set it to 7 to get the next Thursday
|
|
|
|
if [ $DAYS_UNTIL_NEXT_THURSDAY -eq 0 ]; then
|
|
|
|
DAYS_UNTIL_NEXT_THURSDAY=7
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Calculate the date for the next Thursday after the merge
|
|
|
|
THURSDAY_AFTER_MERGE=$(date -u -d "${{ github.event.pull_request.merged_at }} + $DAYS_UNTIL_NEXT_THURSDAY days" +"%Y-%m-%d")
|
2024-02-22 14:00:31 +00:00
|
|
|
WOOAF_RELEASE_DATE=$(date -u -d "${THURSDAY_AFTER_MERGE} + 5 days" +"%Y-%m-%d")
|
2023-10-09 15:54:59 +00:00
|
|
|
TEST_DATE_MESSAGE="Thursday, $THURSDAY_AFTER_MERGE. (Targeting release on $WOOAF_RELEASE_DATE)"
|
|
|
|
echo "TEST_DATE_MESSAGE=${TEST_DATE_MESSAGE}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Determine Milestone Date
|
|
|
|
id: get_milestone_date
|
2024-09-24 14:04:57 +00:00
|
|
|
run: |
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
MILESTONE_TITLE="${{ github.event.pull_request.milestone.title }}"
|
|
|
|
MILESTONE_DATE="Undefined"
|
|
|
|
|
|
|
|
# Mapping of milestone titles to release dates
|
|
|
|
declare -A MILESTONE_DATES
|
|
|
|
MILESTONE_DATES=(
|
|
|
|
["9.4.0"]="2024-10-21"
|
|
|
|
["9.5.0"]="2024-11-25"
|
|
|
|
["9.6.0"]="2024-12-30"
|
|
|
|
["9.7.0"]="2025-02-03"
|
|
|
|
["9.8.0"]="2025-03-10"
|
|
|
|
)
|
|
|
|
|
|
|
|
# Check if the milestone title exists in our predefined list and get the date
|
|
|
|
if [[ -v "MILESTONE_DATES[${MILESTONE_TITLE}]" ]]; then
|
|
|
|
MILESTONE_DATE=${MILESTONE_DATES[${MILESTONE_TITLE}]}
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Export for later steps
|
|
|
|
echo "MILESTONE_DATE=${MILESTONE_DATE}" >> $GITHUB_ENV
|
2023-10-09 15:54:59 +00:00
|
|
|
|
|
|
|
# Notify Slack Step
|
2023-10-05 08:32:19 +00:00
|
|
|
- name: Notify Slack
|
|
|
|
uses: archive/github-actions-slack@d9dae40827adf93bddf939db6552d1e392259d7d
|
|
|
|
id: notify
|
|
|
|
with:
|
|
|
|
slack-bot-user-oauth-access-token: ${{ secrets.TEST_ASSISTANCE_BOT_TOKEN }}
|
2024-09-24 14:11:39 +00:00
|
|
|
slack-channel: ${{ secrets.WOO_CORE_REST_API_CHANGES_SLACK_CHANNEL }}
|
2023-10-05 08:32:19 +00:00
|
|
|
slack-text: |
|
|
|
|
<${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.title }}>
|
|
|
|
*Labels:* ${{ join(github.event.pull_request.labels.*.name, ', ') }}
|
2023-10-09 15:54:59 +00:00
|
|
|
*Monthly Release Milestone:* <${{ github.event.pull_request.milestone.html_url }}|${{ github.event.pull_request.milestone.title }}> (Release Date: ${{ env.MILESTONE_DATE }})
|
2024-08-28 17:37:13 +00:00
|
|
|
Please check the Milestone above and test using the latest <https://github.com/woocommerce/woocommerce/releases|pre-release build>.
|
|
|
|
If a pre-release build for the stated Milestone does not exist, please use the Nightly build.
|
2023-10-05 08:32:19 +00:00
|
|
|
slack-optional-unfurl_links: false
|
|
|
|
slack-optional-unfurl_media: false
|
2023-10-09 15:54:59 +00:00
|
|
|
|