This is a tutorial on how to edit MkDocs websites from Github repos that use the cfde-bot robot. The cfde-bot handles changes in each website GitHub repo to check edits and most importantly, prevent changes that could break the website.
- learn how to edit Mkdocs website documents on Github using the cfde-bot
- learn how to edit documents from sub-module repositories
~20 mins (depending on the website, it may take longer for all the bot's checks to complete)
The cfde-bot was constructed for managing CFDE websites. To edit any of these websites, you must be onboarded to the CFDE to gain access to the nih-cfde Github repo files.
For the CFDE, the key websites we maintain are built from the following Github repositories:
published-documentation. See the specific steps for editing CFDE websites section below for instructions on editing the
use-case-library-build CFDE websites currently have a single PR and review stage to merge changes to the public-facing website. These public-facing websites are rendered from the
latest branch, respectively. The
published-documentation website involves more layers of PR review - please see details below.
training-and-engagement repo has a 2-stage PR and review process. Changes are initially pushed to a development branch
dev and then merged to
stable for new releases of the public-facing website. Consequently, the steps of the PR process are slightly different compared to the other CFDE websites. The details are available in the website repo's style guide and release plan.
In this tutorial, we lay out the general steps for the single stage PR process.
Say you want to edit a CFDE website that merges changes from the
If working from Github, type a new branch name (e.g.,
my_branch) in the
Branch:stable dropdown button and hit
enter. The new branch should be created with the
stable branch as its base.
You should now be on your new branch, otherwise click
Branch:stable and switch to your new branch.
Find the file(s) you want to change and make changes directly in the web interface (while not necessary, you can also make changes via a local copy of the repo with
git commands). When you’re done editing, scroll to the bottom of the page to commit the changes; Github knows to commit the changes to your branch.
Push your changes from
my_branch to the
stable branch by clicking on "Compare & pull request". Add a description about the pull request (PR) and submit it. Depending on the website, follow style guidelines for the PR and review process.
The cfde-bot will now make sure the website can build with these changes. The PR page will update the progress as the bot goes through its checks, starting with a yellow circle and "Some checks haven't completed yet". If the checks complete successfully, the circle turns green with a check mark and the message switches to "All checks have passed". If any checks failed, there will be a red circle with an "X" mark and the message "Some checks were not successful". In the latter case, check the build logs to track the error.
If the checks pass, changes should be automatically merged into a preview version of the readthedocs website. Click on the "Details" button of the "docs/readthedocs.com: — Read the Docs build succeeded!" check to view the rendered preview (the website is rendered for the specific PR).
If you are satisfied with the edits, request reviewers to check, request changes, and approve the changes.
When the PR has been approved, click "Merge pull request" and confirm merge. Be sure to delete your branch. Your edits should now be viewable on the public-facing website!
The website created by the
published-documentation repo pulls some docs that are in its repo AND some from two sub-module repositories (
specifications-and-documentation). There are two ways to make changes to this website that are detailed in the repo's README documentation. The steps are summarized below:
Follow the general steps above, with the following additional steps:
- Push your changes to the
previewbranch first to check the rendered website.
- If the changes look as you expected, make a PR of your branch to
devand tag the admin team (@ACharbonneau or @marisalim), who will check the changes and approve. Approved changes will periodically be promoted to the
stablebranch to be rendered on the public website.
The cfde-bot's process for checking changes to the sub-module repos (
c2m2) is slightly different:
published-documentationcfde-bot checks hourly for changes to the sub-module repo's
masterbranch. Thus, changes should be made directly in these repositories.
It pulls any changes into the
previewbranch of the
published-documentationrepo as a PR.
If the website build checks pass, the bot auto-merges changes into the
previewbranch and renders the preview website.
The cfde-bot simultaneously creates a PR to push the changes to the public website. After review by the admin team, the changes will be merged.
Reminder: you must be onboarded to the CFDE to edit these repositories:
The bot will automatically create preview branches (
update-<repo>-preview) if it detects changes in either of the sub-module repos.
If the website build checks all pass, the bot will then automatically merge:
cookbookpreview, and will build a preview site for you to browse at: https://cfde-published-documentation.readthedocs-hosted.com/en/cookbookpreview/
c2m2preview, and will build a preview site for you to browse at: https://cfde-published-documentation.readthedocs-hosted.com/en/c2m2preview/
The bot will also automatically create branches (
update-<repo>-docs) if it detects changes in either of the sub-module repos. If the preview looks as you expected, approve this matching PR. The bot will automatically tag an admin to review and merge changes that will then be viewable on the public version of the website!