Skip to content

feat: include pull request description in slack notifications#6540

Merged
chenrui333 merged 1 commit into
runatlantis:mainfrom
rym-dd:feat/slack-pr-body-3161
Jun 27, 2026
Merged

feat: include pull request description in slack notifications#6540
chenrui333 merged 1 commit into
runatlantis:mainfrom
rym-dd:feat/slack-pr-body-3161

Conversation

@rym-dd

@rym-dd rym-dd commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

what

This PR aims to add the pull request description to the apply notifications sent through webhooks:

  • add a Body field to models.PullRequest to carry the pull request description
  • populate it in every event parser whose VCS payload exposes a description
  • Bitbucket Cloud and Server are left empty on purpose, as their pull request payloads don't include a description
  • render the description in the Slack apply notification as a full-width Description field, only when it's not empty, and rune-safe truncated to 1000 characters to stay within Slack's message size limits
  • the HTTP webhook payload gains Body automatically since the whole ApplyResult is marshalled, so the payload example in the docs is updated to match

why

  • apply notifications currently expose only the workspace, branch, user and directory, without any context about what was applied
  • surfacing the pull request description gives the change, impact and environment context directly in the notification

tests

  • added tests for createAttachments: the Description field is omitted when the body is empty, included when it's set, and rune-safe truncated when the body exceeds the limit
  • extended the GitHub event parser tests (and fixture) to assert the body is parsed into PullRequest.Body
  • make test passes in the ghcr.io/runatlantis/testing-env container, goimports and gofmt are clean, and golangci-lint reports no issues on the touched packages

before

image

after

image

references

@rym-dd rym-dd force-pushed the feat/slack-pr-body-3161 branch from 8195cc9 to 4447ab9 Compare June 5, 2026 14:28
@rym-dd rym-dd marked this pull request as ready for review June 5, 2026 14:29
Copilot AI review requested due to automatic review settings June 5, 2026 14:29
@dosubot dosubot Bot added feature New functionality/enhancement go Pull requests that update Go code labels Jun 5, 2026
@github-actions github-actions Bot added the docs Documentation label Jun 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR adds pull/merge request descriptions to Atlantis’ internal pull request model and surfaces them in Slack webhook notifications (with truncation), updating parsers, fixtures, tests, and docs accordingly.

Changes:

  • Add Body to models.PullRequest and populate it in GitHub/GitLab/Azure DevOps/Gitea parsing.
  • Include PR description as a Slack attachment field, truncating long descriptions rune-safely.
  • Update test fixtures, parser tests, and docs to cover/reflect the new Body field.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
server/events/webhooks/slack_client.go Adds PR description field to Slack attachments with truncation logic.
server/events/webhooks/slack_client_internal_test.go Adds tests for presence/absence and truncation behavior of the Slack description field.
server/events/models/models.go Introduces PullRequest.Body and documents its intended population behavior.
server/events/event_parser.go Populates Body across supported VCS pull/merge request parsers.
server/events/event_parser_test.go Updates/extends parser tests (incl. Gitea) to assert Body is parsed.
server/events/vcs/github/testdata/fixtures.go Adds GitHub PR body to fixtures for parser tests.
server/events/vcs/azuredevops/testdata/fixtures.go Adds Azure DevOps PR description to fixtures for parser tests.
runatlantis.io/docs/sending-notifications-via-webhooks.md Documents Body in webhook payload example.

Comment thread server/events/models/models.go Outdated
Comment thread server/events/webhooks/slack_client.go Outdated
Comment thread server/events/webhooks/slack_client.go Outdated
Comment thread server/events/webhooks/slack_client_internal_test.go
@rym-dd rym-dd force-pushed the feat/slack-pr-body-3161 branch from be941f7 to ae4a8ca Compare June 5, 2026 14:45
Comment thread server/events/webhooks/slack_client.go Outdated
Comment thread server/events/webhooks/slack_client_internal_test.go Outdated
Comment thread server/events/webhooks/slack_client.go Outdated
@chenrui333 chenrui333 force-pushed the feat/slack-pr-body-3161 branch from 53b5735 to 217dac0 Compare June 26, 2026 23:43
@github-actions github-actions Bot added the dependencies PRs that update a dependency file label Jun 26, 2026
Signed-off-by: Rym Rabehi <rym.rabehi@datadome.co>
Signed-off-by: Rui Chen <rui@chenrui.dev>
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jun 27, 2026
@chenrui333 chenrui333 merged commit f54fc1e into runatlantis:main Jun 27, 2026
44 checks passed
@chenrui333

Copy link
Copy Markdown
Member

Thanks @rym-dd for your first contribution!

@demon

demon commented Jun 27, 2026

Copy link
Copy Markdown

Oh cool, you went with my suggestion :)

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

Labels

dependencies PRs that update a dependency file docs Documentation feature New functionality/enhancement go Pull requests that update Go code lgtm This PR has been approved by a maintainer provider/bitbucket

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add PR summary/body or additional info in slack webhook

5 participants