diff --git a/.github/workflows/test-assistant-api-with-date.yml b/.github/workflows/test-assistant-api-with-date.yml index 7dc497f9d42..62be9d20ecc 100644 --- a/.github/workflows/test-assistant-api-with-date.yml +++ b/.github/workflows/test-assistant-api-with-date.yml @@ -19,23 +19,25 @@ jobs: id: calculate_date run: | #!/bin/bash - MERGED_TIMESTAMP=$(date -u -d "${{ github.event.pull_request.merged_at }}" +"%s") # 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 Wednesday after the merge DAYS_UNTIL_NEXT_WEDNESDAY=$(( (3 - MERGE_DAY_OF_WEEK + 7) % 7 + 1 )) + DAYS_UNTIL_NEXT_THURSDAY=$((DAYS_UNTIL_NEXT_WEDNESDAY + 1)) - # Calculate the next Wednesday timestamp after the merge - WEDNESDAY_AFTER_MERGE_TIMESTAMP=$(date -u -d "${{ github.event.pull_request.merged_at }} + $DAYS_UNTIL_NEXT_WEDNESDAY days" +"%s") + # 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") + NEXT_THURSDAY=$(date -u -d "${{ github.event.pull_request.merged_at }} + $(($DAYS_UNTIL_NEXT_THURSDAY + 7)) days" +"%Y-%m-%d") CURRENT_TIMESTAMP=$(date -u +"%s") + WEDNESDAY_AFTER_MERGE_TIMESTAMP=$(date -u -d "${{ github.event.pull_request.merged_at }} + $DAYS_UNTIL_NEXT_WEDNESDAY days" +"%s") if [[ "$WEDNESDAY_AFTER_MERGE_TIMESTAMP" -le "$CURRENT_TIMESTAMP" ]]; then - TEST_DATE_MESSAGE="Can be tested this Thursday" + TEST_DATE_MESSAGE="Can be tested from: Thursday, $THURSDAY_AFTER_MERGE" else - TEST_DATE_MESSAGE="Can be tested next Thursday" + TEST_DATE_MESSAGE="Can be tested from: Thursday, $NEXT_THURSDAY" fi echo "TEST_DATE_MESSAGE=${TEST_DATE_MESSAGE}" >> $GITHUB_ENV