-
Notifications
You must be signed in to change notification settings - Fork 773
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into ryan/ci-version-bump-only
- Loading branch information
Showing
206 changed files
with
7,287 additions
and
2,788 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,49 +2,77 @@ name: Release Version Alert | |
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
types: | ||
- opened | ||
- synchronize | ||
branches: [ main ] | ||
|
||
jobs: | ||
check-version: | ||
check-version: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout codes | ||
uses: actions/checkout@v4 | ||
|
||
- name: Check for __version__.py changes | ||
id: version-changes | ||
run: | | ||
git fetch | ||
CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }}) | ||
echo "CHANGED_FILES=$CHANGED_FILES" | ||
if echo "$CHANGED_FILES" | grep '__version__.py'; then | ||
echo "Detected __version__.py changes. Proceeding..." | ||
else | ||
echo "No __version__.py changes detected. Skipping workflow..." | ||
echo "SKIP_STEPS=true" >> $GITHUB_ENV # Set an environment variable to indicate skipping steps | ||
fi | ||
uses: actions/checkout@v4 | ||
- name: Get PR information | ||
id: pr-info | ||
run: | | ||
PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") | ||
HAS_PR=false; [ "$PR_NUMBER" != "null" ] && HAS_PR=true | ||
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV | ||
echo "HAS_PR=$HAS_PR" >> $GITHUB_ENV | ||
echo "PR_NUMBER=$PR_NUMBER" | ||
echo "HAS_PR=$HAS_PR" | ||
- name: Check versions | ||
id: check-versions | ||
if: env.SKIP_STEPS != 'true' | ||
run: | | ||
CHECK_NEW_VERSION_RESPONSE=$(bash scripts/check-new-release-version.sh) | ||
if [[ "$CHECK_NEW_VERSION_RESPONSE" == "New release version"* ]]; then | ||
echo "Sending Slack notification..." | ||
MESSAGE="$CHECK_NEW_VERSION_RESPONSE :rocket: Coming soon in PR: https://github.com/$GITHUB_REPOSITORY/pull/$PR_NUMBER " | ||
if [ "$HAS_PR" = true ]; then | ||
MESSAGE="$CHECK_NEW_VERSION_RESPONSE :rocket: Coming soon in PR: https://github.com/$GITHUB_REPOSITORY/pull/$PR_NUMBER " | ||
else | ||
BRANCH_NAME=$(echo "${GITHUB_REF#refs/heads/}") | ||
BRANCH_LINK="https://github.com/${{ github.repository }}/tree/$BRANCH_NAME" | ||
MESSAGE="$CHECK_NEW_VERSION_RESPONSE :rocket: Coming soon in branch: $BRANCH_LINK" | ||
fi | ||
echo "SLACK_MESSAGE=$MESSAGE" >> $GITHUB_ENV | ||
else | ||
echo "No new non-dev version found. Skipping Slack notification." | ||
echo "SKIP_STEPS=true" >> $GITHUB_ENV # Set an environment variable to indicate skipping steps | ||
fi | ||
echo "SLACK_MESSAGE=$MESSAGE" | ||
- name: Generate Message Hash | ||
if: env.SKIP_STEPS != 'true' | ||
id: generate-hash | ||
run: | | ||
MESSAGE_HASH=$(echo "${{env.SLACK_MESSAGE}}" | sha256sum | cut -d ' ' -f1) | ||
echo "MESSAGE_HASH=$MESSAGE_HASH" >> $GITHUB_ENV | ||
- name: Restore Message from Cache | ||
if: env.SKIP_STEPS != 'true' | ||
id: restore-cache | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: message_cache.txt | ||
key: message-cache-${{ env.MESSAGE_HASH }} | ||
- name: Check for Duplicates | ||
if: env.SKIP_STEPS != 'true' | ||
run: | | ||
DUPLICATE_CHECK=$(grep -Fx "${{env.SLACK_MESSAGE}}" message_cache.txt || true) | ||
echo "DUPLICATE_CHECK=$DUPLICATE_CHECK" | ||
if [ -n "$DUPLICATE_CHECK" ]; then | ||
echo "Message already posted. Skipping duplicate Slack notification." | ||
echo "SKIP_STEPS=true" >> $GITHUB_ENV # Set an environment variable to indicate skipping steps | ||
fi | ||
- name: Write Message to Cache File | ||
if: env.SKIP_STEPS != 'true' | ||
run: | | ||
echo "${{env.SLACK_MESSAGE}}" >> message_cache.txt | ||
cat message_cache.txt | ||
- name: Store Message in Cache | ||
if: env.SKIP_STEPS != 'true' | ||
uses: actions/cache/save@v3 | ||
with: | ||
path: message_cache.txt | ||
key: message-cache-${{ env.MESSAGE_HASH }} | ||
- name: Slack Notification | ||
if: env.SKIP_STEPS != 'true' | ||
uses: slackapi/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.