Automate generated tool reference docs #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tool Reference | |
| on: | |
| pull_request: | |
| paths: | |
| - "Source/RimBridgeTools.cs" | |
| - "Tools/RimBridgeServer.ToolDocGen/**" | |
| - "docs/tool-reference.md" | |
| - "scripts/generate-tool-reference.sh" | |
| - ".github/workflows/tool-docs.yml" | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "Source/RimBridgeTools.cs" | |
| - "Tools/RimBridgeServer.ToolDocGen/**" | |
| - "scripts/generate-tool-reference.sh" | |
| - ".github/workflows/tool-docs.yml" | |
| permissions: | |
| contents: write | |
| jobs: | |
| tool-reference: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: "10.0.x" | |
| - name: Generate tool reference | |
| run: scripts/generate-tool-reference.sh | |
| - name: Verify generated doc is committed | |
| if: github.event_name == 'pull_request' | |
| run: git diff --exit-code -- docs/tool-reference.md | |
| - name: Commit generated doc | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| run: | | |
| if git diff --quiet -- docs/tool-reference.md; then | |
| echo "Generated tool reference is already up to date." | |
| exit 0 | |
| fi | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add docs/tool-reference.md | |
| git commit -m "Update generated tool reference [skip ci]" | |
| git push |