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

CLI - Add feature to print markdown docs #2276

Merged
merged 18 commits into from
Feb 19, 2025
Merged

CLI - Add feature to print markdown docs #2276

merged 18 commits into from
Feb 19, 2025

Conversation

bfops
Copy link
Collaborator

@bfops bfops commented Feb 18, 2025

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

@bfops bfops marked this pull request as ready for review February 18, 2025 23:14
@bfops bfops requested a review from cloutiertyler as a code owner February 18, 2025 23:14
Comment on lines 14 to 51
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

Actions Job or Workflow does not set permissions
Copy link
Contributor

@cloutiertyler cloutiertyler left a 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

Unpinned 3rd party Action 'PR-only CI' step
Uses Step
uses 'dsherret/rust-toolchain-file' with ref 'v1', not a pinned commit hash
@bfops bfops enabled auto-merge February 19, 2025 04:18
@bfops bfops added this pull request to the merge queue Feb 19, 2025
Merged via the queue into master with commit 4665c52 Feb 19, 2025
15 checks passed
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

Successfully merging this pull request may close these issues.

2 participants