Repository navigation
CI: Tell the website to copy install.sh when it changes - #1779
Conversation
The one-liner runs the website's copy of scripts/install.sh. The site copies the file only on its daily schedule, which GitHub can start hours late. So a new installer option fails as "unknown option" for up to a day after the merge: install.sh --praxis did on 2026-11-10. The new workflow sends the docs-updated repository_dispatch event to rossoctl/.github when scripts/install.sh changes on main. The site's deploy workflow already listens for it, and rossoctl/rossoctl sends the same event for its docs. Without the SITE_DISPATCH_TOKEN secret, the workflow gives a warning and exits 0. Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Hai Huang <huang195@gmail.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 16 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
clawgenti
left a comment
There was a problem hiding this comment.
Summary
The fix is sound. I checked the receiving side in rossoctl/.github at main: deploy.yaml listens on repository_dispatch with types: [docs-updated], and scripts/sync-docs.sh always shallow-clones rossoctl/cortex at the default branch and copies scripts/install.sh. A dispatch sent after a push to main therefore rebuilds the site with the merged installer. client_payload is informational only, so the receiver ignores it. The SITE_DISPATCH_TOKEN secret already exists on this repo, and the repository_dispatch deploy run at 03:01 UTC today (run 42949939636, build + deploy) succeeded, so the event path works end to end. The workflow is a close copy of rossoctl/rossoctl's docs-dispatch.yaml. It also improves on it by passing steps.dispatch.outputs.notified through env: instead of interpolating it into run:.
Security: no untrusted event fields reach run:. github.sha, github.actor and the run URL go through env: and are quoted. There is no pull_request/pull_request_target trigger, the job-level permissions is contents: read, and no third-party actions are used, so there is nothing to pin. I left two non-blocking comments: one on scoping the cross-repo token, one on the summary text.
Author: huang195 (MEMBER — maintainer)
Areas reviewed: CI/GitHub Actions, cross-repo receiver contract (rossoctl/.github deploy.yaml + sync-docs.sh), Docs
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: passing
| - name: Send repository_dispatch to rossoctl/.github | ||
| id: dispatch | ||
| env: | ||
| GH_TOKEN: ${{ secrets.SITE_DISPATCH_TOKEN }} |
There was a problem hiding this comment.
suggestion: repository_dispatch needs Contents: write on rossoctl/.github, so this secret can also push to the repo that serves /cortex/install.sh, the file people pipe into sh. As written, any job in this repo can read the secret. A write-access user can run workflow_dispatch (or push a workflow file) on any branch, and that branch's copy of this workflow gets the token. You could put the secret in a deployment environment (for example site-dispatch) that allows only main, and add environment: site-dispatch to the job. The token then reaches only workflow files on main. This is not a regression: it is the same pattern as rossoctl/rossoctl's docs-dispatch.yaml. A GitHub App token limited to rossoctl/.github would also make the token short-lived.
| echo "Sent \`docs-updated\` to rossoctl/.github. The site copies" | ||
| echo "\`scripts/install.sh\` from this commit." | ||
| else | ||
| echo "\`SITE_DISPATCH_TOKEN\` is not set, so the site was not notified." |
There was a problem hiding this comment.
nit: Because of if: always(), this branch also runs when the token is set but gh api fails (expired token, 403/404, network). notified is then unset, and the summary says "SITE_DISPATCH_TOKEN is not set", which sends the reader to the wrong cause. Wording like "The site was not notified (see the dispatch step)" would cover both cases. The dispatch step's own failure is still visible.
Problem
curl -fsSL https://www.rossoctl.dev/cortex/install.sh | shruns the website's copy ofscripts/install.sh. The site (rossoctl/.github,deploy.yaml) copies the file from this repository only:docs-updatedrepository dispatch, which this repository never sends;So a new installer option fails as "unknown option" for up to a day after it merges. On 2026-11-10,
install.sh --praxismerged at 15:37 UTC, 39 minutes after the site's copy (14:58 UTC).--ref=maindid not help, because the script reads every option before it acts on--ref.Change
.github/workflows/site-dispatch.yaml. On a push tomainthat changesscripts/install.sh(or by hand), it sendsdocs-updatedtorossoctl/.github. The site's deploy workflow already listens for that event. It is a copy ofrossoctl/rossoctl'sdocs-dispatch.yaml, with only the path, the wording and the setup command changed..github/CLAUDE.md: one row in the workflow table.Setup needed (once, by an admin)
GITHUB_TOKENcannot dispatch to another repository. Create a fine-grained token with Contents: read and write onrossoctl/.githubonly, then:gh secret set SITE_DISPATCH_TOKEN --repo rossoctl/cortexUntil the secret exists, the workflow gives a warning and exits 0. It never fails a merge, and the site's daily schedule still copies the file.
Tests
yamllintwith the config thatsecurity-scans.yamluses: no findings.actionlintv1.7.7: no findings.pre-commit runon the two files: passed.main. After both, run it once by hand (gh workflow run site-dispatch.yaml --repo rossoctl/cortex) and check that arepository_dispatchrun starts inrossoctl/.github.Size: 103 changed lines.
Assisted-By: Claude (Anthropic AI) noreply@anthropic.com