Add build workflow in Github action #283
Conversation
❌ Deploy Preview for kmesh-net failed.
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @beast162! It looks like this is your first PR to kmesh-net/website 🎉 |
There was a problem hiding this comment.
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.
| 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" |
There was a problem hiding this comment.
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.
| }, | ||
| gtag: { | ||
| trackingID: "G-854W8PEZ1Z", | ||
| trackingID: process.env.GA_TRACKING_ID, |
There was a problem hiding this comment.
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.
| trackingID: process.env.GA_TRACKING_ID, | |
| trackingID: process.env.GA_TRACKING_ID || "G-XXXXXXXXXX", |
| "@types/mdx" "^2.0.0" | ||
|
|
||
| "@node-rs/jieba-darwin-arm64@2.0.1": | ||
| "@node-rs/jieba-linux-x64-gnu@2.0.1": |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.trackingIDtoprocess.env.GA_TRACKING_ID. - Added a new “Build Docusaurus” job to
.github/workflows/main.yml, passingGA_TRACKING_IDfrom GitHub Secrets. - Updated
yarn.lock(including platform binary entries and the resolved URL forplugin-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.
| }, | ||
| gtag: { | ||
| trackingID: "G-854W8PEZ1Z", | ||
| trackingID: process.env.GA_TRACKING_ID, |
| - name: Install dependencies | ||
| run: npm install | ||
| - name: Build Docusaurus | ||
| run: npm run build |
| codespell: | ||
| name: Check for spelling errors | ||
| runs-on: ubuntu-latest |
| env: | ||
| GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }} |
|
/deploy-preview |
|
/redeploy |
Signed-off-by: Naveen Hegde <naveenhegde20yellow@gmail.com>
Summary
This PR removes the hardcoded Google Analytics tracking ID from
docusaurus.config.jsand loads it from theGA_TRACKING_IDenvironment variable instead.Changes
trackingIDvalue withprocess.env.GA_TRACKING_IDGA_TRACKING_IDto the Docusaurus build workflow using GitHub Secrets.envto.gitignoreso local environment files are not committedTesting
Ran the Docusaurus production build locally with a test tracking ID:
Issue Link
#252