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

Clicking on "Suggest edits" opens main branch edit page #72

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

Clicking on "Suggest edits" opens main branch edit page #72

rifont opened this issue Sep 16, 2023 · 3 comments

Comments

@rifont
Copy link
Contributor

rifont commented Sep 16, 2023

When clicking on the "Suggest edits" button from the documentation site, the Github edit page is opened up on the main branch. This behaviour conflicts with the Publishing Changes section in the Readme which asks for changes to be submitted against the staging branch, and results in a non-optimal DX for contributors.

image

For example, my previous PR (#70) was opened through the "Suggest edits" feature and defaulted to merging to main - this branch mismatch was not caught during review.

Unfortunately, it's not possible to setup Github branch protection to enforce that pull requests come from a specific branch, but it is possible to setup a Github workflow for this check (see https://stackoverflow.com/a/75414339/19305547).

Possible fixes:

  • Investigate if Mintlify config supports specifying a base branch for the "Suggest edits" feature
  • Implement Github workflow to enforce merges to main come only from staging
@rifont rifont changed the title Clicking on "Suggest edits" from docs opens main branch Clicking on "Suggest edits" from docs opens main branch edit Sep 16, 2023
@rifont rifont changed the title Clicking on "Suggest edits" from docs opens main branch edit Clicking on "Suggest edits" opens main branch edit page Sep 16, 2023
@rifont
Copy link
Contributor Author

rifont commented Sep 16, 2023

Mintlify have made the previously public mintlify/mint repo private, so the mintlify generation code is no longer available to browse on the web.

After some digging into the mintlify cli, and running npx mintlify dev, the mintlify/mint monorepo is cloned and a NextJS local web server is spun up under ~/.mintlify/mint/client. This enables perusal of the code generating the aforementioned Github edit URL in compiled JS (summarised for brevity):

const { owner, repo, deployBranch, contentDirectory: deploymentPath } = mintConfig.repo.github;
href = `https://github.com/${owner}/${repo}/edit/${deployBranch}/${removeFirstSlash(deploymentPath)}${removeFirstSlash(`${path}.mdx`)}`

The Mintlify platform appends the repo.github properties to the mint.json during docs deployment. The edit branch defaults to the deployBranch.

The solution must therefore be provided via Mintlify. One backward compatible solution would be to provide an additional suggestEditBranch option which overrides the default deployBranch configured in the Mintlify platform. I will raise this as a feature request in https://github.com/mintlify/docs/issues.

@rifont
Copy link
Contributor Author

rifont commented Sep 16, 2023

Raised mintlify/docs#99

@jainpawan21
Copy link
Member

Thanks @richardfontein 🙌🏻
Waiting for fix from mintlify

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

2 participants