name: Update Documentation on: push: branches: - main workflow_dispatch: # Default to read-only; the publishing job escalates to contents: write. permissions: contents: read concurrency: group: ${{github.workflow}}-${{ github.ref }} cancel-in-progress: true env: GO_VERSION: '1.25' PROJECT_NAME: witr jobs: update-docs: runs-on: ubuntu-latest permissions: contents: write steps: - name: Checkout uses: actions/checkout@v7 with: fetch-depth: 0 - name: Set up Go uses: actions/setup-go@v6 with: go-version: ${{ env.GO_VERSION }} check-latest: true - name: Create man.1 documentation run: | go run internal/tools/docgen/main.go -out ./docs/cli -format man - name: Create markdown documentation run: | go run internal/tools/docgen/main.go -out ./docs/cli -format markdown - name: Commit and push documentation env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git add docs/cli if git diff --cached --quiet; then echo "No changes to commit" exit 0 fi git commit -m "docs: update CLI documentation" - name: Push documentation run: | git push origin ${{ github.ref }}