Skip to content

feat(webhook): add reviewer name to MS Teams review request notifications#38289

Open
SudhanshuMatrix wants to merge 4 commits into
go-gitea:mainfrom
SudhanshuMatrix:feat/msteams-review-reviewer
Open

feat(webhook): add reviewer name to MS Teams review request notifications#38289
SudhanshuMatrix wants to merge 4 commits into
go-gitea:mainfrom
SudhanshuMatrix:feat/msteams-review-reviewer

Conversation

@SudhanshuMatrix

@SudhanshuMatrix SudhanshuMatrix commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Include the requested reviewer's username (along with their full name in parentheses, if available) and render the Repository and Pull request fields as clickable links in Microsoft Teams webhook notifications.

Fixes: #38270

Changes

  • services/webhook/msteams.go:
    • Updated the createMSTeamsPayload helper function to globally format the Repository: fact as a clickable markdown link using the repository's full name and HTML URL.
    • Updated the PullRequest convertor to format the requested reviewer as Username (Full Name) (falling back to just Username if the full name is empty) and append a new Requested Reviewer: fact when the action is a review request or removal.
    • Updated the PullRequest and Review convertors to format the Pull request: fact as a clickable markdown link using the PR index and HTML URL.
    • Cleaned up the duplicate manual Repository: fact from the Wiki converter since the shared helper now automatically generates the formatted link.
  • services/webhook/msteams_test.go:
    • Updated the test suite assertions to expect the new markdown link formats for all repository and pull request facts.

Verification

  • Ran unit tests successfully:
    go test ./services/webhook/

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 1, 2026
@github-actions github-actions Bot added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Jul 1, 2026
@bircni

bircni commented Jul 1, 2026

Copy link
Copy Markdown
Member

Any UI example?

@SudhanshuMatrix

SudhanshuMatrix commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@bircni Since MessageCards are a legacy format and Microsoft recommends using Adaptive Cards for new Microsoft Teams development, I couldn't find a way to preview the MessageCard JSON directly. As a workaround, I converted the MessageCard JSON payload into an Adaptive Card. The converted card renders successfully

Do you happen to have access to a Microsoft Developer Sandbox or the credentials for one? If so, we could use it to test this in a Microsoft 365 environment.

I applied for a Microsoft Developer Sandbox earlier, but it seems Microsoft isn't granting sandbox subscriptions to new users at the moment, so I wasn't able to get access. If you already have one available, it would be really helpful for testing.
image

@itxaiohanglover itxaiohanglover left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice implementation — the variadic extraFacts ... refactoring is clean and the reviewer name fallback from FullName to UserName is correct. Test coverage for the review request case is good.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jul 2, 2026
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jul 2, 2026
@lunny lunny added this to the 28.0 milestone Jul 2, 2026
Comment thread services/webhook/msteams.go
SudhanshuMatrix and others added 2 commits July 3, 2026 07:34
Include the  full name in parentheses, if available instead of the fallback

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Signed-off-by: Shudhanshu Singh <sudhanshuwriterblc@gmail.com>
@SudhanshuMatrix

Copy link
Copy Markdown
Contributor Author

It would be great if this could be tested manually. Currently, the MessageCard JSON is converted to an Adaptive Card only to provide a rough preview. See the comment for more details: #38289 (comment).

If anyone has access to a Microsoft Developer Sandbox (or other testing credentials), I'd really appreciate your help testing this. Alternatively, if someone can test it manually and confirm whether everything works as expected, that would be very helpful. Thanks!

…links in MS Teams payloads

- Format the Repository fact using the markdown link syntax with Repository HTML URL
- Format the Pull Request fact using the markdown link syntax with Pull Request HTML URL and Index
- Remove redundant Repository fact from Wiki webhook converter
- Update MSTeams payload unit tests to expect the link formats
@bircni

bircni commented Jul 4, 2026

Copy link
Copy Markdown
Member

It would be great if this could be tested manually. Currently, the MessageCard JSON is converted to an Adaptive Card only to provide a rough preview. See the comment for more details: #38289 (comment).

If anyone has access to a Microsoft Developer Sandbox (or other testing credentials), I'd really appreciate your help testing this. Alternatively, if someone can test it manually and confirm whether everything works as expected, that would be very helpful. Thanks!

can't you just post it into your teams team?

@SudhanshuMatrix SudhanshuMatrix requested a review from bircni July 4, 2026 13:04
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. labels Jul 4, 2026
@SudhanshuMatrix

Copy link
Copy Markdown
Contributor Author

The issue poster is already helping (see #38270). I'm on Linux and only use the Teams web client, and I don't see any option there to post or preview MessageCard JSON. I don't know whether that is a web-client limitation, a tenant/permission restriction, or a premium feature. I attached an Adaptive Card preview earlier as a rough reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/need 1 This PR needs approval from one additional maintainer to be merged. type/feature Completely new functionality. Can only be merged if feature freeze is not active.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve MS Teams Webhook notification for Pull Request Review Requests

6 participants