Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide mint.json configuration option to customise suggest edit branch #99

Open
rifont opened this issue Sep 16, 2023 · 0 comments
Open

Comments

@rifont
Copy link
Contributor

rifont commented Sep 16, 2023

Problem

Novu docs (https://github.com/novuhq/docs) use a Gitflow branching model with 2 primary branches. All changes first make their way into a trunk branch, and the trunk is periodically merged into the Mintlify deploy branch.

By default, the Mintlify "Suggest edit" feature opens the Github edit page on the deploy branch for the docs, which for repositories using a Gitflow branching model, is the incorrect branch for edits to be made on. This results in poor contributor DX and can result in edits erroneously being pushed against the deploy branch if branch merge checks are not enforced.

Proposed Feature

The mint.json should provide an optional feedback.suggestEditBranch configuration option to enable customisation of the "Suggest edits" branch. If the optional configuration option is not provided, the auto-generated repo.github.deployBranch option should be used.

Proposed Solution

The useUserFeedBack hook can be updated with the following code to support this backward compatible change:

const { suggestEditBranch } = mintConfig?.feedback;
let editBranch;
if (suggestEditBranch) {
    editBranch = suggestEditBranch;
} else {
    editBranch = deployBranch;
}
...
dispatch({
    type: FeedBackActionEnum.SET_CREATE_SUGGEST_HREF,
    payload: `https://github.com/${owner}/${repo}/edit/${editBranch}/${removeFirstSlash(urlPath)}${removeFirstSlash(`${path}.mdx`)}`
});

Who will benefit from this feature?

  • Mintlify customers using a Gitflow branching model to manage changes
  • Mintlify customers preferring suggested edits to be made against a custom branch
  • Contributors to public documentation using the Mintlify platform

I am willing to contribute to the https://github.com/mintlify/docs to support this feature.

rifont added a commit to rifont/docs-mintlify that referenced this issue Sep 16, 2023
* Adds documentation for the `suggestEditBranch` feature proposed in mintlify#99
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

No branches or pull requests

1 participant