Add GitHub Actions workflow to generate and publish API documentation#13
Add GitHub Actions workflow to generate and publish API documentation#13i-am-that-guy merged 1 commit intomainfrom
Conversation
WalkthroughA new GitHub Actions workflow is added to automate the generation and publishing of API documentation. The workflow triggers on pushes to the main branch when changes occur in specific source or configuration files. It installs dependencies, generates documentation using apidoc, and deploys the output to GitHub Pages. Changes
Estimated code review effort1 (~2 minutes) Poem
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
.github/workflows/apidocs.yml (3)
3-9: Consider broader / manual triggersLimiting the trigger to
src/routes/**andapidoc.jsonmeans doc regeneration is skipped when comments in other folders (e.g.src/controllersormiddleware) change, or when you simply want to republish without code changes.
Addworkflow_dispatch(and optionallypull_request) to avoid blind spots.
16-23: Usebun addfor single-package install (nit)
bun installis intended to install dependencies from an existingpackage.json; passing a package name works but is undocumented.
bun add --no-save apidocis the canonical, self-documenting command.- - name: Install apidoc with Bun - run: bun install --no-save apidoc + - name: Install apidoc with Bun + run: bun add --no-save apidoc
27-31: Optional: enable fast re-runs & cleaner historyAdd a concurrency group to cancel stale builds and set a commit message for clarity:
docs: + concurrency: apidocs-${{ github.ref }} … - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} + commit_message: "docs: update API reference (CI)" publish_dir: ./docs/apidoc
| jobs: | ||
| docs: | ||
| runs-on: ubuntu-latest | ||
| steps: |
There was a problem hiding this comment.
Workflow will fail to push without explicit write permissions
peaceiris/actions-gh-pages needs contents: write on the GITHUB_TOKEN.
GitHub Actions now defaults tokens to read-only; the deploy step will error with Permission denied (publickey) or remote: Permission to … denied.
Add explicit permissions:
jobs:
docs:
+ permissions:
+ contents: write # allow push to gh-pages
runs-on: ubuntu-latest🤖 Prompt for AI Agents
In .github/workflows/apidocs.yml around lines 10 to 13, the GitHub Actions
workflow lacks explicit write permissions for the GITHUB_TOKEN, causing the
deploy step using peaceiris/actions-gh-pages to fail with permission errors. Add
a permissions section to the workflow specifying 'contents: write' to grant the
necessary write access for pushing changes.
|
@i-am-that-guy merge kar lena approve kar di hai |
Summary by CodeRabbit