Skip to content

fix: show PR head branch instead of base branch in Slack notifications#6316

Open
kiwibel wants to merge 3 commits intorunatlantis:mainfrom
kiwibel:fix/slack-head-branch
Open

fix: show PR head branch instead of base branch in Slack notifications#6316
kiwibel wants to merge 3 commits intorunatlantis:mainfrom
kiwibel:fix/slack-head-branch

Conversation

@kiwibel
Copy link

@kiwibel kiwibel commented Mar 16, 2026

Summary

  • Changed Slack notification to display the PR's head (source) branch instead of the base (target) branch
  • Updated test fixture to include HeadBranch value
  • Added internal unit test asserting the Branch attachment field uses HeadBranch

Why

The base branch is almost always main, which provides no useful context in Slack notifications. Showing the head branch instead makes it immediately clear which feature/fix was applied.

Test plan

  • Unit tests pass (go test ./server/events/webhooks/...)
  • Added TestCreateAttachments_HeadBranch to validate the Branch field value

Copilot AI review requested due to automatic review settings March 16, 2026 03:09
@dosubot dosubot bot added the go Pull requests that update Go code label Mar 16, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates Atlantis’ Slack apply notifications so the displayed branch corresponds to the PR’s head/source branch, aligning the message with what users typically care about when reviewing applies.

Changes:

  • Slack attachment “Branch” field now uses applyResult.Pull.HeadBranch instead of BaseBranch.
  • Updated Slack client test setup fixture to populate HeadBranch.

Reviewed changes

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

File Description
server/events/webhooks/slack_client.go Changes the Slack attachment branch value to the PR head branch.
server/events/webhooks/slack_client_test.go Adds HeadBranch to the ApplyResult test fixture data.

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

Labels

go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants