Skip to content

ci: add new release version alert #10

ci: add new release version alert

ci: add new release version alert #10

name: Release Version Alert
on:
pull_request:
branches: [ main ]
jobs:
check-version:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get PR information
id: pr-info
run: |
PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
PR_HASH=$(git rev-parse HEAD)
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
echo "PR_HASH=$PR_HASH" >> $GITHUB_ENV
- name: Check versions
id: check-versions
run: |
CHECK_NEW_VERSION_RESPONSE=$(bash scripts/check-new-release-version.sh)
if [[ "$(bash scripts/check-new-release-version.sh)" == "Found new non-dev version"* ]]; then
echo "Sending Slack notification..."
MESSAGE="$CHECK_NEW_VERSION_RESPONSE \nPR: https://github.com/$GITHUB_REPOSITORY/pull/$PR_NUMBER\nHash: $PR_HASH :rocket:"
echo "SLACK_MESSAGE=$MESSAGE" >> $GITHUB_ENV
else
echo "No new non-dev version found. Skipping Slack notification."
fi
- name: Slack Notification
if: steps.check-versions.outputs.message != ''
uses: slackapi/[email protected]
with:
channel-id: 'C05RVKRFCCF'
slack-message: ${{ steps.check-versions.outputs.message }}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}