-
Notifications
You must be signed in to change notification settings - Fork 177
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
CLI - Add feature to print markdown docs #2276
Conversation
.github/workflows/pr-only-ci.yml
Outdated
name: Check CLI docs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Find Git ref | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
shell: bash | ||
run: | | ||
PR_NUMBER="${{ github.event.inputs.pr_number || null }}" | ||
if test -n "${PR_NUMBER}"; then | ||
GIT_REF="$( gh pr view --repo clockworklabs/SpacetimeDB $PR_NUMBER --json headRefName --jq .headRefName )" | ||
else | ||
GIT_REF="${{ github.ref }}" | ||
fi | ||
echo "GIT_REF=${GIT_REF}" >>"$GITHUB_ENV" | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ env.GIT_REF }} | ||
- uses: dsherret/rust-toolchain-file@v1 | ||
- uses: actions/setup-dotnet@v4 | ||
with: | ||
global-json-file: modules/global.json | ||
- name: Checkout docs | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: clockworklabs/spacetime-docs | ||
ref: master | ||
path: spacetime-docs | ||
- name: Check for docs change | ||
run: | | ||
cargo run --features markdown-docs -p spacetimedb-cli > spacetime-docs/docs/cli-reference.md | ||
cd spacetime-docs | ||
if ! git diff-index --quiet HEAD; then | ||
echo "It looks like the CLI docs have changed" | ||
git diff | ||
exit 1 | ||
fi |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, given that this comes with a CI test to test the cfg
, I'm willing to accept this.
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ env.GIT_REF }} | ||
- uses: dsherret/rust-toolchain-file@v1 |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
Description of Changes
This adds a new feature that makes
spacetimedb-cli
just output markdown-formatted helptext. (It doesn't function as a normal CLI with this feature enabled, it just prints the helptext).This is in order to make it easy to generate CLI reference sections for our docs for clockworklabs/spacetime-docs#105.
API and ABI breaking changes
Not breaking.
Expected complexity level and risk
1
Testing
See clockworklabs/spacetime-docs#168 for an example of the output. That PR also includes README updates for how to use this change.
tl;dr
cargo run --features markdown-docs -p spacetimedb-cli
CI