GitBook change requests are available on every plan with content drafts.
Content drafts are covered in Content
drafts.
Before you connect
You need:- project management permission in DevTune;
- a GitBook personal access token. GitBook doesn’t offer DevTune an app or OAuth sign-in, so DevTune works with a token you create.
[email protected], rather than
your own account:
- A personal token stops working when its owner leaves or loses access.
- Change requests opened with a dedicated member’s token aren’t attributed to one person.
- Give that member the Editor role, the lowest GitBook role that can create change requests. An Editor can’t merge them. A Reviewer or a higher role can, and a space’s own permissions can raise a member’s role there.
What DevTune can touch
The token can do whatever its GitBook member can. DevTune uses it only to:- read your organization’s sites, spaces and pages;
- create change requests in the spaces you map, write the draft to them, and open, update or archive them;
- check whether they were merged.
Connect GitBook
- Open your project’s Settings and select the Integrations tab.
- Under Content repositories, select Connect GitBook.
- Paste the token into GitBook personal access token and select Connect GitBook.
- If the token’s member belongs to more than one GitBook organization, choose the GitBook organization and select Connect GitBook again.
If connecting fails
Content sources
A GitBook content source maps a site address onto a space:
To add a content source:
- Under Content repositories, find Add a content source.
- If you also connected GitHub, set Hosted on to GitBook.
- If you connected more than one GitBook organization, choose the GitBook organization.
- Select one of the suggested site addresses. DevTune suggests the address GitBook publishes each space at, and selects its Space. A GitBook source’s site address must be one GitBook publishes its space at.
- Select Add source.
Each source row can also show:
- This token can also merge change requests in this space. DevTune never merges. The token’s member can merge there. DevTune still won’t; to have GitBook enforce it too, give that member the Editor role in the space.
- GitBook syncs this space with a repository. A merged change request reaches that repository through GitBook’s Git Sync.
Open a change request from a draft
You need project management permission.- Open an action with a content draft.
- In the Draft section, select Create change request.
docs.example.com/guides/quickstart is the page
guides/quickstart. DevTune reads the live page and applies every section
edit to it. If any change doesn’t match the page, nothing is written. If no
page is found, enter its Page path and select Try again.
Create actions. DevTune adds a new page at the brief’s target path, under
the page one level up, which must already exist. The page’s title and
description come from the draft.
The change request’s subject is the action’s title. Its description says
DevTune opened it from a draft approved by the member who created it, links the
action, and lists the brief’s acceptance criteria and any facts the fact check
still flags. For a new page, it reminds the reviewer to check where the page
sits in the navigation.
After writing, DevTune reads the page back from the change request. If GitBook
stored it differently from what DevTune wrote, DevTune archives a change
request it just created, so a reviewer never sees an edit nobody meant. On an
update, it leaves the change request open with the reviewer’s work in it and
shows the refusal.
DevTune does not open a change request for a locked
page.
Update a change request
After you select Generate new draft, the Draft section shows The newest draft is not in this change request yet. Select Update change request to write the new version to the same change request. If someone else edited the change request in GitBook, DevTune leaves their work alone and refuses the update. If the change request is behind the space and GitBook reports conflicts when DevTune brings it up to date, DevTune writes nothing. In both cases, make further changes in GitBook, or close the change request and create a new one.Close a change request
Select Close change request and confirm. DevTune archives it in GitBook. The draft stays in DevTune, and you can create a new change request.Automatic change requests
Turn on Open change requests automatically beside a GitBook content source. It is off by default. It works as automatic pull requests do: each new content draft for a page under that source opens the action’s change request, or writes the draft to its open one, as the member who started the draft run. When GitBook’s rate limit is used up, DevTune waits and tries again later rather than failing.Merge in GitBook
GitBook doesn’t notify DevTune, so DevTune checks your change requests about every ten minutes, and when you open the action. The action shows Checked in GitBook with the time of the last check.- Merged. The action is marked live as of the time it merged in GitBook, even when DevTune notices later, and its before/after window opens in Results. A refresh action uses its own page URL. A new page uses the source’s site address plus the page’s path in GitBook.
- Archived. The change request is recorded as Closed. The action is unchanged, and you can create a new change request. If someone reopens and merges it in GitBook within 90 days of closing, DevTune still marks the action live.
Limits
- DevTune stops checking a closed change request 90 days after it closed.
- When GitBook’s rate limit for the token is used up, opening the action shows the last recorded state instead of checking. Create, update and close refuse until it refills, usually within a minute.
- If an older change request is merged after DevTune stopped checking it, select Mark live on the action yourself.
Disconnect and reconnect
DevTune checks the token once a day. A content source shows Reconnect needed when:- GitBook rejects the token, for example because its member left. The organization shows Reconnect needed and GitBook rejected this token. Replace it to reconnect. Account owners get a notice and an email.
- The token’s member loses edit access to the source’s space. The source says The token can no longer edit this space. Give its GitBook member edit access again. Account owners get a notice and an email. The source recovers at the next daily check after you restore access.
Refusals
When DevTune can’t create, update or close a change request, the Draft section shows why.API and MCP
Your own agents use the same endpoints and tools as GitHub pull requests. The content source decides whether DevTune opens a pull request or a change request:GET /api/v2/projects/{projectId}/setup/content-sourcesanddevtune_get_content_sourcesreturnprovider: "gitbook"with thespaceand theconnection(organization and GitBook member) for GitBook sources.POST /api/v2/projects/{projectId}/actions/{actionId}/draft/pull-requestanddevtune_create_draft_pull_requestaccept an optionalpagePathfor a GitBook page.