Skip to content

ci: set up automated github pages deployment workflow#47

Merged
Vaishnav88sk merged 3 commits into
masterfrom
feat/docs-cicd
Jun 16, 2026
Merged

ci: set up automated github pages deployment workflow#47
Vaishnav88sk merged 3 commits into
masterfrom
feat/docs-cicd

Conversation

@Vaishnav88sk

@Vaishnav88sk Vaishnav88sk commented Jun 16, 2026

Copy link
Copy Markdown
Owner

📖 Description

Resolves #43.

This PR establishes a fully automated, free CI/CD pipeline to deploy the Claritty documentation website to GitHub Pages. It completely eliminates the need for manual npm run build and npm run deploy commands locally.

💡 What Changed

  • Workflow Automation: Created .github/workflows/docs.yaml.
  • Triggers: The action automatically runs on pushes to master if the path is website, and can also be triggered manually via workflow_dispatch.
  • Pipeline Architecture:
    • Installs Node.js 20 and caches npm dependencies for lightning-fast future builds.
    • Generates the optimized static HTML/JS/CSS assets in website/build/.
    • Utilizes peaceiris/actions-gh-pages@v4 to safely force-push the static assets to the gh-pages branch.

Summary by CodeRabbit

  • Chores
    • Added an automated documentation site deployment workflow that publishes the Docusaurus site to the GitHub Pages branch when changes are pushed to the main branch, including manual on-demand deployments.

@Vaishnav88sk Vaishnav88sk added this to the v1.1 Release milestone Jun 16, 2026
@Vaishnav88sk Vaishnav88sk self-assigned this Jun 16, 2026
@Vaishnav88sk Vaishnav88sk added enhancement New feature or request ci Related to CI chnages labels Jun 16, 2026
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5a1e96b5-6bab-429b-b101-76657a20538f

📥 Commits

Reviewing files that changed from the base of the PR and between 190269b and 3f1645a.

📒 Files selected for processing (1)
  • .github/workflows/docs.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/docs.yaml

📝 Walkthrough

Walkthrough

A new GitHub Actions workflow file .github/workflows/docs.yaml is added. It triggers on pushes to master that affect website/** and on manual dispatch, builds the Docusaurus site with Node.js 20, and deploys the output to the gh-pages branch using peaceiris/actions-gh-pages@v4.

Changes

Docs CI/CD Pipeline

Layer / File(s) Summary
Docs deploy workflow
.github/workflows/docs.yaml
Adds a workflow triggered on master pushes to website/** and workflow_dispatch. Checks out the repo, sets up Node.js 20 with npm cache keyed to website/package-lock.json, runs npm ci and npm run build in website/, then publishes ./website/build to gh-pages via peaceiris/actions-gh-pages@v4 with GITHUB_TOKEN.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • Vaishnav88sk/claritty#45: Adds website documentation pages and configuration that work in conjunction with this workflow's build and deployment pipeline.

Poem

🐇 Hop, hop, the docs take flight,
To gh-pages branch tonight!
Node twenty builds the site with care,
A rabbit pushed the workflow there.
Now every merge makes docs go live — 🌐
Watch the Claritty website thrive!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: setting up automated GitHub Pages deployment via a CI workflow.
Linked Issues check ✅ Passed All coding requirements from issue #43 are met: workflow file created, Node.js setup, npm ci/build steps implemented, and peaceiris/actions-gh-pages used for deployment.
Out of Scope Changes check ✅ Passed Only the .github/workflows/docs.yaml file was added, which is directly scoped to issue #43's requirements with no extraneous changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/docs-cicd

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
.github/workflows/docs.yaml (3)

19-20: ⚡ Quick win

Consider setting persist-credentials: false for defense in depth.

The checkout action persists the GitHub token in .git/config by default. While this workflow doesn't upload artifacts that could leak the token, setting persist-credentials: false is a security best practice that reduces the attack surface.

🔒 Proposed hardening
       - name: Checkout repository
         uses: actions/checkout@v4
+        with:
+          persist-credentials: false
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/docs.yaml around lines 19 - 20, Add the
`persist-credentials: false` parameter to the `actions/checkout@v4` action to
prevent the GitHub token from being persisted in the .git/config file. This
reduces the potential attack surface by ensuring credentials are not stored
unnecessarily, which is a security best practice for GitHub Actions workflows.

Source: Linters/SAST tools


14-17: ⚡ Quick win

Consider adding a job timeout for reliability.

Without an explicit timeout, the job can run up to the repository default (often 6 hours), which could mask hanging builds. A reasonable timeout prevents resource waste and fails faster.

⏱️ Proposed enhancement
   deploy:
     name: Deploy to GitHub Pages
     runs-on: ubuntu-latest
+    timeout-minutes: 10
     steps:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/docs.yaml around lines 14 - 17, The deploy job in the
workflow file lacks an explicit timeout configuration, which allows it to run
indefinitely (up to the repository default of 6 hours). Add a timeout-minutes
field to the deploy job definition to set a reasonable timeout limit that
prevents hanging builds and resource waste. This timeout should be set at the
job level, ensuring the job fails fast if it exceeds the specified duration.

20-20: ⚖️ Poor tradeoff

Optional: Pin actions to commit SHAs for supply-chain security.

The static analysis tool flags unpinned action references. While semantic version tags (e.g., @v4) are acceptable for trusted actions, pinning to commit SHAs provides stronger supply-chain guarantees by preventing tag manipulation attacks. This is a defense-in-depth measure rather than a critical vulnerability.

🔐 Example SHA pinning (verify current SHAs)
       - name: Checkout repository
-        uses: actions/checkout@v4
+        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

       - name: Setup Node.js
-        uses: actions/setup-node@v4
+        uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0

       - name: Deploy to gh-pages
-        uses: peaceiris/actions-gh-pages@v4
+        uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0

Note: Always verify SHA hashes against official releases before pinning. Consider using Dependabot to keep pinned SHAs up to date.

Also applies to: 23-23, 38-38

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/docs.yaml at line 20, The actions/checkout reference uses
a semantic version tag (`@v4`) instead of being pinned to a specific commit SHA
for supply-chain security. Update the uses field for the actions/checkout action
to pin it to a full commit SHA instead of the version tag. This same change
needs to be applied to all other unpinned action references in the workflow file
(which appear at multiple locations based on the review comment).

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/docs.yaml:
- Around line 1-43: The GitHub Pages deployment workflow lacks concurrency
control, allowing multiple pushes to master to trigger parallel deployment runs
that can race and conflict when updating the gh-pages branch. Add a concurrency
configuration to the deploy job that specifies a concurrency group (using a
descriptive name like "github-pages-deployment") and explicitly set
cancel-in-progress to false to ensure queued deployments complete in order
rather than being canceled, preventing deployment conflicts and ensuring all
changes eventually get deployed.

---

Nitpick comments:
In @.github/workflows/docs.yaml:
- Around line 19-20: Add the `persist-credentials: false` parameter to the
`actions/checkout@v4` action to prevent the GitHub token from being persisted in
the .git/config file. This reduces the potential attack surface by ensuring
credentials are not stored unnecessarily, which is a security best practice for
GitHub Actions workflows.
- Around line 14-17: The deploy job in the workflow file lacks an explicit
timeout configuration, which allows it to run indefinitely (up to the repository
default of 6 hours). Add a timeout-minutes field to the deploy job definition to
set a reasonable timeout limit that prevents hanging builds and resource waste.
This timeout should be set at the job level, ensuring the job fails fast if it
exceeds the specified duration.
- Line 20: The actions/checkout reference uses a semantic version tag (`@v4`)
instead of being pinned to a specific commit SHA for supply-chain security.
Update the uses field for the actions/checkout action to pin it to a full commit
SHA instead of the version tag. This same change needs to be applied to all
other unpinned action references in the workflow file (which appear at multiple
locations based on the review comment).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0429020e-5f18-4f4c-a61d-7a3d31bf316a

📥 Commits

Reviewing files that changed from the base of the PR and between a8f1108 and 190269b.

📒 Files selected for processing (1)
  • .github/workflows/docs.yaml

Comment thread .github/workflows/docs.yaml
@github-actions

Copy link
Copy Markdown

Code Coverage

Package Line Rate Health
github.com/Vaishnav88sk/claritty/clarctl-go/cmd 36%
github.com/Vaishnav88sk/claritty/clarctl-go/internal/ai 72%
github.com/Vaishnav88sk/claritty/clarctl-go/internal/config 92%
github.com/Vaishnav88sk/claritty/clarctl-go/internal/ui 12%
github.com/Vaishnav88sk/claritty/sre-agent/hub/internal/api 60%
github.com/Vaishnav88sk/claritty/sre-agent/agent/internal/ai 67%
github.com/Vaishnav88sk/claritty/sre-agent/agent/internal/k8s 71%
Summary 62% (992 / 1622)

@Vaishnav88sk
Vaishnav88sk merged commit c8c7827 into master Jun 16, 2026
9 checks passed
@Vaishnav88sk
Vaishnav88sk deleted the feat/docs-cicd branch June 16, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Related to CI chnages enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Docs] Set up GitHub Pages CI/CD Pipeline

1 participant