[RHDHBUGS-3010]: Fix GitHub publication workflow#2100
Conversation
…ode.js - Fix CQA-14 recursion: write preliminary build-report.json before CQA so CQA-14 reads lychee results without triggering a full rebuild that wipes PR build output and overwrites main on gh-pages - Remove stale CDN index fetch (fetchUrl, updateRootIndex) from orchestrator - Rewrite deploy-gh-pages.sh as deploy-gh-pages.js with integrated cleanup (stale PR dirs via GitHub API, deleted branches via git ls-remote), index regeneration with release notes links, and rebase retry - Consolidate deploy + cleanup into single gh-pages commit - Add lychee exclusion for VPN-only release notes URL - Add architecture documentation for the publication workflow Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The rsync on line 148 already copies the entire build/scripts directory including cqa/. The subsequent rm + cp of the same cqa/ directory was a leftover from before rsync was used. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Legacy utility script with no references from any workflow, script, or documentation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
build-cqa.sh: thin wrapper for node cqa/index.js --all, never referenced by any workflow or script. lint-scripts.sh: local shellcheck runner superseded by the shellcheck.yml workflow using reviewdog. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Cleanup of merged PRs and deleted branches is now part of the deploy step (deploy-gh-pages.js), not a separate workflow step. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Quick reference for each script, CQA usage, and workflow mappings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove reference to deleted build/scripts/build.sh asciidoctor alternative. Update deploy script reference from .sh to .js. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix prerequisites: Node.js + Podman (not asciidoctor) - Note that build includes lychee and CQA automatically - Fix lychee section: clarify manual vs automatic, remove false claim that orchestrator downloads lychee - Fix [code,terminal] to [source,terminal] - Fix missing link: prefix on RHDHPAI URL - Add link to architecture documentation - Remove redundant ccutil preference note Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Shellcheck Analysis ResultsChanged shell scripts in this PR: 1 Scripts analyzed:
Check the Files changed tab for detailed shellcheck suggestions. All findings are reported as warnings and won't block the PR. Automated shellcheck analysis • See shellcheck.net for details |
PR Build ResultsBuild failed -- 34/34 titles | 127s Content Quality AssessmentCQA Report
SummaryChecks: 19 total, 19 pass, 0 fail 19 checks: 19 pass, 0 fail Run Updated 2026-04-24 15:34:10 UTC |
6d2a34b to
30613e9
Compare
30613e9 to
3e1e807
Compare
3e1e807 to
b1f1b25
Compare
b1f1b25 to
f7d888a
Compare
Shellcheck: filter out deleted .sh files before running shellcheck, preventing reviewdog parse error on empty input. SonarCloud: use http.extraHeader for git auth instead of embedding token in remote URL, avoiding security hotspot. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
f7d888a to
56c1458
Compare
|
|
||
| // ── Content application ────────────────────────────────────────────────────── | ||
|
|
||
| function applyContent(deployDir, publishDir, branchDir) { |
There was a problem hiding this comment.
what does this wrapper achieve? why not call cpSync directly in the 2 places where this function lives?
|
|
||
| // Branch cleanup: remove directories for deleted remote branches | ||
| const branchDirs = readdirSync(deployDir).filter(d => | ||
| !d.startsWith('pr-') && !d.startsWith('.') && statSync(join(deployDir, d)).isDirectory() |
There was a problem hiding this comment.
would we add other patterns here, like rhdh-* and 1.* branches which are EOL?
Or do we just delete branches manually from https://github.com/redhat-developer/red-hat-developers-documentation-rhdh/branches/stale so that they're not recreated?
- Replace node:https callback API with fetch() (Node 18+) - Remove unused branchDir parameter from applyContent() - Extract cleanup from stageAndCommit into pushWithRetry (runs once, not per retry) - Deduplicate readdirSync call for diagnostics - Add flow overview and inline comments for non-obvious decisions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
nickboldt
left a comment
There was a problem hiding this comment.
moving to .js for "easier maintainability and testing" is kinda funny when you have to replace cp with a method called cpsync and haven't added actual tests...
but sure.
/lgtm
The Node.js rewrite was 325 lines for functionality that fits naturally in ~289 lines of bash. The deploy script's core job is git operations (fetch, copy, add, commit, push) which read more naturally in shell. Changes from the original 88-line script: - Rebase-based retry replaces sleep-based retry (instant vs 2+ minutes) - Cleanup of stale PR/branch dirs integrated (was separate workflow step) - Index regeneration integrated (was in build-orchestrator.js) - Token auth via http.extraHeader (was in remote URL, leaked in logs) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add comment: orphan path is a bootstrap safety net - Add comment: branch cleanup catches all stale branches via ls-remote Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
New changes are detected. LGTM label has been removed. |
Keep the original CLI style: deploy-gh-pages.sh <publish_dir> [--message <msg>] Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Branch cleanup now fetches all remote heads in a single call instead of one ls-remote per directory. Also adds cross-reference to orchestrator's getReleaseNotesLink() for maintainability. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The gh-pages branch has existed for years; the orphan creation path was unreachable code. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SonarCloud S7682 flags implicit returns in bash functions as unclear intent. Adding explicit return 0 to all five flagged functions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|



IMPORTANT: Do Not Merge - To be merged by Docs Team Only
Version(s): All (main, release-1.9+)
Issue: https://redhat.atlassian.net/browse/RHDHBUGS-3010
Preview: N/A (workflow and build script changes)
Summary
main/on gh-pages (preliminary report +CQA_RUNNINGguard)deploy-gh-pages.shas Node.js (deploy-gh-pages.js) with integrated cleanup of merged/closed PRs and deleted branches, index regeneration with release notes links, and rebase retry on push conflictsbuild.sh,build-cqa.sh,lint-scripts.shpr.ymlbuild-asciidoc.ymlto use single deploy step (replaces deploy + inline cleanup)docs/github-publication-workflow.md)README.adoc: accurate Jira URLs, prerequisites, release notes info,.Prerequisites/.ProcedurestructureTest plan
pr-N/(notmain/) on gh-pagesmain/with cleanup and index regeneration🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com