-
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
Open
vamshigovardhana
wants to merge
5
commits into
webex:next
Choose a base branch
from
vamshigovardhana:webex-space-bot
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+96
−0
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
fc08e37
ci(bot): Add Webex Space release notification workflow
vamshigovardhana fb56677
ci: add webex space notification workflow
vamshigovardhana dd9258f
ci: remove old workflow file after rename
vamshigovardhana 027e4be
ci: suppress curl response output to hide UUIDs from logs
vamshigovardhana b2abd1e
ci: remove workflow_dispatch inputs and suppress curl output
vamshigovardhana File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| name: Webex Space Release Notification | ||
| run-name: ${{ github.actor }} triggered Webex space notification | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| 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: | | ||
| 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 '#') | ||
| echo "📦 Tag: ${VERSION}, PR: #${PR_NUMBER}" | ||
|
|
||
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | ||
| echo "version_number=${VERSION#v}" >> $GITHUB_OUTPUT | ||
| echo "pr_number=${PR_NUMBER}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Get Changelog URL from PR Comment | ||
| id: get-changelog | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const prNumber = '${{ steps.tag-info.outputs.pr_number }}'; | ||
| if (!prNumber) { | ||
| console.log('❌ No PR number, skipping changelog fetch'); | ||
| core.setOutput('changelog_url', ''); | ||
| return; | ||
| } | ||
|
|
||
| const comments = await github.rest.issues.listComments({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: parseInt(prNumber) | ||
| }); | ||
|
|
||
| const botComment = comments.data.find(c => | ||
| c.user.type === 'Bot' && | ||
| c.body.includes('Your changes are now available') | ||
| ); | ||
|
|
||
| if (botComment) { | ||
| const match = botComment.body.match(/\[View full changelog[^\]]*\]\(([^)]+)\)/); | ||
| const url = match ? match[1] : ''; | ||
| console.log(`✅ Found changelog URL: ${url}`); | ||
| core.setOutput('changelog_url', url); | ||
| } else { | ||
| console.log('⚠️ No bot comment found on PR'); | ||
| core.setOutput('changelog_url', ''); | ||
| } | ||
|
|
||
| - 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 }}" | ||
| PR_NUMBER="${{ steps.tag-info.outputs.pr_number }}" | ||
| CHANGELOG_URL="${{ steps.get-changelog.outputs.changelog_url }}" | ||
|
|
||
| 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 > /dev/null | ||
|
|
||
| echo "✅ Message sent successfully!" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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