maomaowm/.github/workflows/generate-nix-options-docs.yml
Ruixi-rebirth d5db98cfb7
fix(scripts): improve nix options doc generator
- Restore missing description on hm enable option (fixes nix build warning)
- Rewrite format_default_value into format_value with example support and nix code blocks
- Fix Nix markup stripping: {tag}`content` now preserves backtick content
- Generalize ::: block handling beyond {.note} to any block type
- Switch output from Markdown table to labeled fields format
2026-05-13 04:04:36 +08:00

49 lines
1.3 KiB
YAML

name: Generate Nix Options Docs
on:
push:
paths:
- 'nix/**-modules.nix'
- 'nix/generate-options.nix'
- 'flake.nix'
- '.github/scripts/generate-nix-options-docs.py'
pull_request:
paths:
- 'nix/**-modules.nix'
jobs:
update-docs:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Install Nix
uses: cachix/install-nix-action@v30
with:
extra_nix_config: |
experimental-features = nix-command flakes
- name: Build Options JSON
run: |
nix build .#nixos-options-json --out-link result-nixos
nix build .#hm-options-json --out-link result-hm
- name: Format to Markdown
run: |
python3 ./.github/scripts/generate-nix-options-docs.py \
result-nixos/share/doc/nixos/options.json \
result-hm/share/doc/nixos/options.json \
docs/nix-options.md
- name: Auto-commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "docs: auto-generate Nix module options"
file_pattern: 'docs/*-options.md'
branch: ${{ github.head_ref }}