-
Notifications
You must be signed in to change notification settings - Fork 395
feat(ci): add Webex bot to comment SDK version and changelog on merged PRs #4737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Changes from 1 commit
fc08e37
fb56677
dd9258f
027e4be
b2abd1e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| name: Webex Space Release Notification | ||
| run-name: ${{ github.actor }} triggered Webex space notification | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| test_version: | ||
| description: 'Test version number (e.g., 3.10.0)' | ||
| required: false | ||
| default: '3.10.0' | ||
| test_pr_number: | ||
| description: 'Test PR number (e.g., 123)' | ||
| required: false | ||
| default: '' | ||
|
||
| workflow_run: | ||
| workflows: ["Deploy CD"] | ||
| types: | ||
| - completed | ||
| branches: | ||
| - next | ||
|
|
||
| jobs: | ||
| notify-webex-space: | ||
| name: Send Webex Space Notification | ||
| runs-on: ubuntu-latest | ||
| if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} | ||
|
|
||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Get Version and PR from Tag | ||
| id: tag-info | ||
| run: | | ||
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | ||
| VERSION="${{ github.event.inputs.test_version }}" | ||
| PR_NUMBER="${{ github.event.inputs.test_pr_number }}" | ||
| echo "🧪 TEST MODE: version=${VERSION}, pr=${PR_NUMBER}" | ||
| else | ||
| git fetch --tags | ||
| VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "") | ||
| if [ -z "$VERSION" ]; then | ||
| echo "❌ No tags found" | ||
| exit 1 | ||
| fi | ||
| TAG_MESSAGE=$(git tag -l --format='%(contents:subject)' "$VERSION") | ||
| PR_NUMBER=$(echo "$TAG_MESSAGE" | grep -oE '#[0-9]+' | head -1 | tr -d '#') | ||
| COMMIT_HASH=$(echo "$TAG_MESSAGE" | awk '{print $1}') | ||
| echo "📦 Tag: ${VERSION}, PR: #${PR_NUMBER}, Commit: ${COMMIT_HASH}" | ||
| echo "commit_hash=${COMMIT_HASH}" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | ||
| echo "version_number=${VERSION#v}" >> $GITHUB_OUTPUT | ||
| echo "pr_number=${PR_NUMBER}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Build Package Tools | ||
| run: | | ||
| yarn install | ||
| yarn build:tools | ||
|
|
||
| - name: Get Packages | ||
| id: get-packages | ||
| run: | | ||
| PR_NUMBER="${{ steps.tag-info.outputs.pr_number }}" | ||
|
|
||
| if [ -z "$PR_NUMBER" ]; then | ||
| echo "❌ No PR number found, using default package" | ||
| echo "packages=[\"webex\"]" >> $GITHUB_OUTPUT | ||
| echo "primary_package=webex" >> $GITHUB_OUTPUT | ||
| exit 0 | ||
| fi | ||
|
|
||
| echo "✅ Getting packages for PR #${PR_NUMBER}" | ||
|
|
||
| # Get packages with --recursive to include dependent packages (like webex) | ||
| PACKAGES=$(yarn package-tools list --recursive --since origin/next 2>/dev/null || echo "webex") | ||
|
|
||
| echo "📦 Detected packages: ${PACKAGES}" | ||
|
|
||
| # Convert comma-separated to JSON array | ||
| PACKAGES_JSON=$(echo "$PACKAGES" | tr ',' '\n' | sed 's/.*/"&"/' | tr '\n' ',' | sed 's/,$//' | sed 's/^/[/' | sed 's/$/]/') | ||
|
|
||
| echo "packages=${PACKAGES_JSON}" >> $GITHUB_OUTPUT | ||
|
|
||
| # Check if webex is in the packages list | ||
| if echo "$PACKAGES" | grep -q "webex"; then | ||
| echo "primary_package=webex" >> $GITHUB_OUTPUT | ||
| echo "✅ webex detected in packages" | ||
| else | ||
| # Use first package | ||
| PRIMARY=$(echo "$PACKAGES" | tr ',' '\n' | head -1) | ||
| echo "primary_package=${PRIMARY}" >> $GITHUB_OUTPUT | ||
| echo "📦 Primary package: ${PRIMARY}" | ||
| fi | ||
|
|
||
| - name: Post Webex Space Message | ||
| env: | ||
| WEBEX_BOT_TOKEN: ${{ secrets.WEBEX_BOT_TOKEN }} | ||
| WEBEX_ROOM_ID: ${{ secrets.WEBEX_ROOM_ID }} | ||
|
Comment on lines
+77
to
+78
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have we added these secrets?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Shreyas281299 Yes I have added that secrets |
||
| run: | | ||
| VERSION="${{ steps.tag-info.outputs.version }}" | ||
| VERSION_NUMBER="${{ steps.tag-info.outputs.version_number }}" | ||
| COMMIT_HASH="${{ steps.tag-info.outputs.commit_hash }}" | ||
| PRIMARY_PACKAGE="${{ steps.get-packages.outputs.primary_package }}" | ||
| PR_NUMBER="${{ steps.tag-info.outputs.pr_number }}" | ||
|
|
||
| # Calculate stable version (strip -next.X suffix) | ||
| STABLE_VERSION=$(echo "$VERSION_NUMBER" | sed 's/-next\..*//') | ||
|
|
||
| # Build changelog URL | ||
| CHANGELOG_URL="https://web-sdk.webex.com/changelog/?stable_version=${STABLE_VERSION}" | ||
|
|
||
| # Add package parameter | ||
| if [ -n "${PRIMARY_PACKAGE}" ]; then | ||
| ENCODED_PACKAGE=$(node -e "console.log(encodeURIComponent(process.argv[1]))" "${PRIMARY_PACKAGE}") | ||
| CHANGELOG_URL="${CHANGELOG_URL}&package=${ENCODED_PACKAGE}" | ||
| fi | ||
|
|
||
| # Add version parameter | ||
| if [ -n "${VERSION_NUMBER}" ]; then | ||
| CHANGELOG_URL="${CHANGELOG_URL}&version=${VERSION_NUMBER}" | ||
| fi | ||
|
|
||
| echo "🔗 Changelog URL: ${CHANGELOG_URL}" | ||
|
||
|
|
||
| # Build the message - simple format: SDK version, PR link, Changelog link | ||
| PR_LINK="https://github.com/${{ github.repository }}/pull/${PR_NUMBER}" | ||
|
|
||
| MESSAGE="**SDK Version:** ${VERSION}\n\n**PR:** ${PR_LINK}\n\n**Changelog:** ${CHANGELOG_URL}" | ||
|
|
||
| echo "📨 Sending message to Webex Space..." | ||
|
|
||
| curl -sSf \ | ||
| -H "Authorization: Bearer ${WEBEX_BOT_TOKEN}" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d "{\"roomId\":\"${WEBEX_ROOM_ID}\",\"markdown\":\"${MESSAGE}\"}" \ | ||
| https://webexapis.com/v1/messages | ||
|
|
||
| echo "✅ Message sent successfully!" | ||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Git-hub run:https://github.com/vamshigovardhana/webex-js-sdk/actions/runs/22941175851/job/66582913230