Skip to content

Add build workflow in Github action #283

Open
beast162 wants to merge 1 commit intokmesh-net:mainfrom
beast162:main
Open

Add build workflow in Github action #283
beast162 wants to merge 1 commit intokmesh-net:mainfrom
beast162:main

Conversation

@beast162
Copy link
Copy Markdown

@beast162 beast162 commented May 2, 2026

Summary

This PR removes the hardcoded Google Analytics tracking ID from docusaurus.config.js and loads it from the GA_TRACKING_ID environment variable instead.

Changes

  • Replaced the hardcoded trackingID value with process.env.GA_TRACKING_ID
  • Added GA_TRACKING_ID to the Docusaurus build workflow using GitHub Secrets
  • Added .env to .gitignore so local environment files are not committed

Testing

Ran the Docusaurus production build locally with a test tracking ID:

Issue Link

#252

GA_TRACKING_ID=G-TEST123 npm run build

Copilot AI review requested due to automatic review settings May 2, 2026 04:38
@netlify
Copy link
Copy Markdown

netlify Bot commented May 2, 2026

Deploy Preview for kmesh-net failed.

Name Link
🔨 Latest commit 99f2906
🔍 Latest deploy log https://app.netlify.com/projects/kmesh-net/deploys/69f5817382d0ff0008a2f0c6

@kmesh-bot
Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign yaozengzeng for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kmesh-bot
Copy link
Copy Markdown
Collaborator

Welcome @beast162! It looks like this is your first PR to kmesh-net/website 🎉

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Docusaurus configuration to use an environment variable for the Google Analytics tracking ID and modifies the yarn.lock file by replacing Darwin-specific dependencies with Linux ones and changing the resolution protocol for plugin-image-zoom to git+ssh. Feedback highlights that the tracking ID change requires a fallback value to prevent build failures in environments where the variable is undefined. Furthermore, the lockfile modifications are noted to potentially break macOS builds and introduce security risks by removing integrity checksums and requiring SSH access for dependency resolution.

Comment thread yarn.lock
version "1.1.0"
resolved "https://codeload.github.com/flexanalytics/plugin-image-zoom/tar.gz/8e1b866c79ed6d42cefc4c52f851f1dfd1d0c7de"
integrity sha512-y/KQYx2qGrnMwB0zPxxN3g2teitLlHjGFJDoepfjJg2cC1AB5qCC9Bzp5YsNGQb2+Vw0Nd4O32b8FQGTgFSrVw==
resolved "git+ssh://git@github.com/flexanalytics/plugin-image-zoom.git#8e1b866c79ed6d42cefc4c52f851f1dfd1d0c7de"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

security-high high

The resolution protocol for plugin-image-zoom has changed from https to git+ssh. This will likely break builds in CI environments that do not have SSH keys configured for GitHub. Additionally, the integrity checksum has been removed, which is a security regression as it prevents verification of the package content. It is recommended to revert this to the https version.

Comment thread docusaurus.config.js Outdated
},
gtag: {
trackingID: "G-854W8PEZ1Z",
trackingID: process.env.GA_TRACKING_ID,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The trackingID is now assigned directly from process.env.GA_TRACKING_ID. If this environment variable is not defined (which is the case for local development by default or PR previews), the Docusaurus build will fail during configuration validation because the gtag plugin expects a non-empty string. Consider providing a fallback value to ensure the site remains buildable without the environment variable.

Suggested change
trackingID: process.env.GA_TRACKING_ID,
trackingID: process.env.GA_TRACKING_ID || "G-XXXXXXXXXX",

Comment thread yarn.lock
"@types/mdx" "^2.0.0"

"@node-rs/jieba-darwin-arm64@2.0.1":
"@node-rs/jieba-linux-x64-gnu@2.0.1":
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This change replaces the Darwin (macOS) specific dependency for @node-rs/jieba with a Linux-specific one. This typically happens when yarn.lock is updated on a different operating system. This will break the build for developers using macOS. It is recommended to maintain a cross-platform lockfile that includes entries for all supported platforms.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the hardcoded Google Analytics tracking ID from the Docusaurus config and wires a GA tracking ID secret into GitHub Actions while adding a Docusaurus build job to CI.

Changes:

  • Switched Docusaurus gtag.trackingID to process.env.GA_TRACKING_ID.
  • Added a new “Build Docusaurus” job to .github/workflows/main.yml, passing GA_TRACKING_ID from GitHub Secrets.
  • Updated yarn.lock (including platform binary entries and the resolved URL for plugin-image-zoom).

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.

File Description
docusaurus.config.js Reads GA tracking ID from an environment variable instead of hardcoding it.
.github/workflows/main.yml Adds a Node build job and injects GA_TRACKING_ID during the build.
yarn.lock Updates lock entries; introduces Linux-only binary entries and switches a GitHub dependency to git+ssh.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docusaurus.config.js Outdated
},
gtag: {
trackingID: "G-854W8PEZ1Z",
trackingID: process.env.GA_TRACKING_ID,
Comment on lines +24 to +27
- name: Install dependencies
run: npm install
- name: Build Docusaurus
run: npm run build
Comment on lines 31 to 33
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest
Comment on lines +28 to +29
env:
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
@jayesh9747
Copy link
Copy Markdown
Contributor

/deploy-preview

@jayesh9747
Copy link
Copy Markdown
Contributor

/redeploy

Signed-off-by: Naveen Hegde <naveenhegde20yellow@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants