GitHub Actions Example: Syncing Markdown
ReadMe Refactored GuidanceThis guidance is only applicable for projects that have been migrated to ReadMe Refactored. The Refactored project architecture requires
rdme@10
, while the legacy project architecture requiresrdme@9
.For more information, check out our migration guide
Do you have Markdown files stored on GitHub? With the rdme
GitHub Action, you can sync them to ReadMe every time they're updated in GitHub. Let's go over how to set this up!
Constructing a GitHub Actions Workflow
In order to construct the workflow file, you'll first want to grab a project version or branch to ensure that your docs sync to the right place in your developer hub. That version or branch will be passed via the --branch
flag. See below for a full example:
name: Sync `documentation` directory to ReadMe
# Run workflow for every push to the `main` branch
on:
push:
branches:
- main
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout this repo
uses: actions/checkout@v4
# Run GitHub Action to sync docs in `documentation` directory
- name: GitHub Action
# We recommend specifying a fixed version, i.e. @v10
# Docs: https://docs.github.com/actions/using-workflows/workflow-syntax-for-github-actions#example-using-versioned-actions
uses: readmeio/rdme@v10
with:
rdme: docs upload ./documentation --key=${{ secrets.README_API_KEY }} --branch=2.0
In the example above, every push to the main
branch will sync the Markdown contents of the documentation
directory to version 2.0 of your ReadMe project.
Keepingrdme
up-to-dateNote that
@v10
(used in the above example) is the latest version ofrdme
. We recommend configuring Dependabot to keep your actions up-to-date.
Updated 17 days ago