Skip to content

forge: Add merge and checks APIs#1213

Merged
abhinav merged 3 commits into
mainfrom
forge-merge-api
May 31, 2026
Merged

forge: Add merge and checks APIs#1213
abhinav merged 3 commits into
mainfrom
forge-merge-api

Conversation

@abhinav

@abhinav abhinav commented May 31, 2026

Copy link
Copy Markdown
Owner

Extracted from #1152

This adds forge-level APIs for merging changes
and reading aggregate CI/checks state.
GitHub, GitLab, Bitbucket, and ShamHub now expose the new forge methods
where their backing APIs support them.

Checks-state integration tests now cover pending, passing,
and failing checks for ShamHub, GitHub, and GitLab.

ShamHub also gained support for simulating checks state
through its existing test forge system,
including a shamhub set-status command
for setting a PR's synthetic checks state during tests.

Finally, this removes the unused ErrMergeNotAllowed sentinel
from the forge contract.
It was only declared and documented here,
and was unused in the branch-merge branch as well.

[skip changelog]: internal forge API and test infrastructure changes

ed-irl and others added 3 commits May 31, 2026 06:23
Teach forge repositories how to merge changes directly
and report aggregate checks state.
This gives command handlers a provider-neutral contract
for merge operations while keeping provider-specific REST
and GraphQL shapes behind the forge boundary.

GitHub and GitLab pass expected head SHAs through their merge APIs
so callers can reject stale plans.
Bitbucket exposes merge support without head assertions
because its API does not provide that guard.

Checks state now has a shared `forge.ChecksState` contract.
GitHub, GitLab, Bitbucket, and ShamHub map provider statuses
into pending, passed, or failed
so merge orchestration can wait on CI
without knowing provider-specific status names.

ShamHub gains a REST merge endpoint
and `shamhub config mergeMethod`
for tests that need server-side merge or squash behavior
when the client does not specify a method.

Extracted from #1152

Co-Authored-By: Abhinav Gupta <mail@abhinavg.net>
Checks-state support needs replayable coverage that exercises each
forge boundary without relying on manually configured CI jobs.

Add a shared integration scenario that submits fresh changes and asks
each provider test harness to install pending, passed, and failed
checks state. ShamHub now models that state directly and exposes
`shamhub set-status` for script tests, while GitHub, GitLab, and
Bitbucket use provider status APIs for fixture recording.
Unused here and in branch-merge.
@abhinav

abhinav commented May 31, 2026

Copy link
Copy Markdown
Owner Author

This change is part of the following stack:

Change managed by git-spice.

@abhinav abhinav merged commit 879c6fd into main May 31, 2026
22 checks passed
@abhinav abhinav deleted the forge-merge-api branch May 31, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants