From 151d4749ea59de238c759badfbbfda73f0276041 Mon Sep 17 00:00:00 2001 From: Adam Gohs Date: Sat, 11 Apr 2026 15:58:18 -0400 Subject: [PATCH 1/2] Disable Google Analytics on preview builds Preview builds were firing page view events into the production GA property, inflating metrics with internal review traffic. Skip the @docusaurus/plugin-google-gtag plugin when DOCUSAURUS_IS_PREVIEW=true is set by pr-preview.yml. --- .github/workflows/pr-preview.yml | 1 + docusaurus.config.js | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index f0e744b61..ec65ede11 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -36,6 +36,7 @@ jobs: env: DOCUSAURUS_URL: https://usace-rmc.github.io DOCUSAURUS_BASE_URL: /RMC-Software-Documentation-Previews/pr-${{ github.event.pull_request.number }}/ + DOCUSAURUS_IS_PREVIEW: 'true' run: npm run build - uses: peaceiris/actions-gh-pages@v4 with: diff --git a/docusaurus.config.js b/docusaurus.config.js index 938aa44b9..8042d12ef 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -89,14 +89,20 @@ export default { ], plugins: [ - // Google Analytics plugin - [ - '@docusaurus/plugin-google-gtag', - { - trackingID: 'G-LB2BWWGDTB', - anonymizeIP: true, - }, - ], + // Google Analytics plugin — production builds only. + // Preview builds set DOCUSAURUS_IS_PREVIEW=true so they don't pollute + // the production GA property with pr-preview page views. + ...(process.env.DOCUSAURUS_IS_PREVIEW === 'true' + ? [] + : [ + [ + '@docusaurus/plugin-google-gtag', + { + trackingID: 'G-LB2BWWGDTB', + anonymizeIP: true, + }, + ], + ]), // TailwindCSS as a custom plugin tailwindPlugin, From 287865ef3bbed536c31d9a466fd91a8c8773cbad Mon Sep 17 00:00:00 2001 From: Adam Gohs Date: Sat, 11 Apr 2026 16:01:07 -0400 Subject: [PATCH 2/2] Set review-workflow commit status for non-docs PRs in ci-build.yml Non-docs PRs were being blocked by branch protection because nothing was flipping the review-workflow status to success. stage-progression.yml handles it for docs PRs, but ci-build.yml needs to handle the non-docs path or those PRs can't merge. --- .github/workflows/ci-build.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 66634f1a3..2141a02d1 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -7,6 +7,7 @@ on: permissions: contents: read pull-requests: write + statuses: write jobs: build: @@ -35,8 +36,21 @@ jobs: const touchesDocs = files.some(f => f.filename.startsWith('docs/')); if (touchesDocs) return; // docs PRs are handled by stage-progression.yml + // Flip the review-workflow commit status to success so branch + // protection allows merge. This is the non-docs counterpart to + // stage-progression.yml's status-setting for docs PRs. + const headSha = context.payload.pull_request.head.sha; + await github.rest.repos.createCommitStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + sha: headSha, + state: 'success', + context: 'review-workflow', + description: 'No doc changes — admin may merge', + }); + const marker = ''; - const sha = context.payload.pull_request.head.sha.substring(0, 7); + const sha = headSha.substring(0, 7); const body = `${marker}\n\nāœ… **CI build passed** for commit \`${sha}\`\n\nThis PR does not touch documentation content under \`docs/\`, so no multi-stage review is required.\n\n@usace-rmc/docs-admin may merge.`; const comments = await github.rest.issues.listComments({ owner: context.repo.owner, repo: context.repo.repo, issue_number: prNumber }); const existing = comments.data.find(c => c.user.type === 'Bot' && c.body.includes(marker));