Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 142 additions & 0 deletions .github/workflows/webex-space-notification.yml
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image The version is incorrect here. It should be a pre-release version (3.X.0-next.X)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2026-03-12 at 2 42 53 PM The message says 3.10.0 but the link says 3.4.0. Please verify this

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: ''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think this is required

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Shreyas281299 Yah I will remove it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still see these changes

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we added these secrets?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are changing how the URL is created this would again become an issue, and we would end up creating a wrong URL.

By this time our deploy pipeline would have commented the correct cahngelog link. we can fetch that comment from the PR and use it. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Shreyas281299 if i implement this logic "The Webex space notification workflow fetches the changelog URL from the PR comment posted by the comment-on-prs job in deploy.yml. But since both are triggered after Deploy CD completes, what if the Webex bot runs before the PR comment is posted? Should we add a retry/polling mechanism, or is there a better way to ensure the comment exists first?"


# 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!"
Loading