mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add head_branch to pull request diff status (#23076)
Adds the `head_branch` field (the source/feature branch name of a PR) to the diff status pipeline. Previously only `base_branch` (target branch) and the head commit SHA were captured from the GitHub API, but not the head branch name itself. ## Changes - **Migration 438**: Add `head_branch` nullable TEXT column to `chat_diff_statuses` - **gitprovider**: Parse `head.ref` from the GitHub API response (alongside `head.sha`) and add `HeadBranch` to `PRStatus` - **gitsync**: Wire `HeadBranch` through `refreshOne()` into the DB upsert params - **worker**: Map `HeadBranch` in `chatDiffStatusFromRow()` - **coderd**: Convert `HeadBranch` in `convertChatDiffStatus()` - **codersdk**: Expose as `head_branch` (`*string`, omitempty) in `ChatDiffStatus` API response - **Tests**: Updated `github_test.go` pull JSON fixtures and assertions
This commit is contained in:
@@ -367,6 +367,7 @@ INSERT INTO chat_diff_statuses (
|
||||
author_login,
|
||||
author_avatar_url,
|
||||
base_branch,
|
||||
head_branch,
|
||||
pr_number,
|
||||
commits,
|
||||
approved,
|
||||
@@ -386,6 +387,7 @@ INSERT INTO chat_diff_statuses (
|
||||
sqlc.narg('author_login')::text,
|
||||
sqlc.narg('author_avatar_url')::text,
|
||||
sqlc.narg('base_branch')::text,
|
||||
sqlc.narg('head_branch')::text,
|
||||
sqlc.narg('pr_number')::integer,
|
||||
sqlc.narg('commits')::integer,
|
||||
sqlc.narg('approved')::boolean,
|
||||
@@ -406,6 +408,7 @@ SET
|
||||
author_login = EXCLUDED.author_login,
|
||||
author_avatar_url = EXCLUDED.author_avatar_url,
|
||||
base_branch = EXCLUDED.base_branch,
|
||||
head_branch = EXCLUDED.head_branch,
|
||||
pr_number = EXCLUDED.pr_number,
|
||||
commits = EXCLUDED.commits,
|
||||
approved = EXCLUDED.approved,
|
||||
|
||||
Reference in New Issue
Block a user