From e418fafbdf89f2c888129dbe7ea19fffd961746f Mon Sep 17 00:00:00 2001 From: fullsend-code <278716306+fullsend-ai-coder[bot]@users.noreply.github.com> Date: Thu, 19 Nov 2026 20:56:24 +0000 Subject: [PATCH 1/2] docs(#9715): document bare github setup re-run as single-repo upgrade A repository set up with fullsend github setup has no repos.yaml manifest, so fullsend repos install cannot upgrade it. A bare re-run of github setup already upgrades such a repository in one setup PR, but the docs did not name it as the supported route, and operations.md showed --inference-* flags that re-serialize .fullsend/config.yaml and drop its comments. Name the bare re-run as the single-repo upgrade in operations.md, docs/cli/github.md and the repo-management Required upgrade section. Say what it changes (shim trigger, workflow pin, repo variables and secrets), what it keeps (config.yaml, a custom FULLSEND_APP_SET), and when to add flags (--vendor, --fullsend-ref, values set only as repo variables, config key changes). Add TestRunGitHubSetupPerRepo_Rerun_UpgradesPullRequestTargetShim: a flag-less re-run on a repo with a pull_request_target shim delivers one setup commit whose shim triggers on pull_request only, moves the pin off the old release, and does not commit .fullsend/config.yaml. Note: pre-commit could not fetch remote hook repos (TLS verification failed in the sandbox). The applicable hooks were run directly instead: whitespace, EOF and line-ending checks, gofmt, go vet, lint-docs-links, lint-broken-symlinks and lychee all passed; secrets were checked with scan-secrets. Six internal/cli tests fail in the sandbox for environmental reasons unrelated to this change (fetchserver dial permission denied; PostScriptEnv tests read FULLSEND_OUTPUT_SCHEMA from the sandbox environment). Closes #9715 Co-Authored-By: Claude Opus 5.5 --- docs/cli/github.md | 19 +++++- docs/guides/getting-started/operations.md | 37 +++++++++-- .../guides/getting-started/repo-management.md | 33 +++++++--- internal/cli/github_test.go | 64 +++++++++++++++++++ 4 files changed, 140 insertions(+), 13 deletions(-) diff --git a/docs/cli/github.md b/docs/cli/github.md index 258506037e..4b1ec0f9fc 100644 --- a/docs/cli/github.md +++ b/docs/cli/github.md @@ -30,7 +30,24 @@ fullsend github setup \ The values passed to `--inference-gateway-*` and `--openai-*` come from the gateway operator and the OpenAI organization admin; see [Using an inference gateway](../guides/user/inference-gateway.md) and [OpenAI Workload Identity](../guides/infrastructure/openai-workload-identity.md). -**Re-running per-repo setup** (for example after a fullsend upgrade) refreshes the managed +**Re-running per-repo setup** with no flags is the supported way to upgrade a single repository +that is not declared in a [`fullsend repos`](repos.md) manifest. `fullsend repos install` needs a +manifest. Upgrade the CLI, then run: + +```bash +fullsend self-update # or download the release +fullsend github setup "$OWNER/$REPO" +``` + +The re-run opens one setup PR that moves the shim trigger from `pull_request_target` to +`pull_request` and updates the workflow pin to the CLI's release. It also rewrites the repository +variables and secrets from `.fullsend/config.yaml`. A custom `FULLSEND_APP_SET` repository variable +stays as it is. Re-pass `--vendor` or `--fullsend-ref` if the install used them: a re-run without +`--vendor` removes the vendored assets. A value set only as a repository variable, such as +`FULLSEND_MINT_URL` or `FULLSEND_GCP_REGION`, and not in `config.yaml` goes back to the +`config.yaml` value or the default. Put it in `config.yaml`, or pass its flag. + +A re-run refreshes the managed workflow files but never rewrites an existing `.fullsend/config.yaml` on its own: `agents:` entries and their per-agent settings, allowlists and hand-written comments stay as they are, the runtime prompt is skipped, and the setup PR reports the runtime the file already selects. Passing a flag that targets a diff --git a/docs/guides/getting-started/operations.md b/docs/guides/getting-started/operations.md index 13f96db6b4..3d6bc13875 100644 --- a/docs/guides/getting-started/operations.md +++ b/docs/guides/getting-started/operations.md @@ -116,14 +116,43 @@ To upgrade the fullsend CLI, download the latest release from [GitHub Releases](https://github.com/fullsend-ai/fullsend/releases), or run [`fullsend self-update`](../../cli/self-update.md) on v0.55.0 or later. -After upgrading the fullsend CLI, re-run `github setup` to update the workflow file for a single repo: +To upgrade a single repository set up with `fullsend github setup`, upgrade +the CLI and re-run `github setup` with no flags. This bare re-run is the +supported single-repo upgrade: ```bash -fullsend github setup "$OWNER/$REPO" \ - --inference-project "" \ - --inference-wif-provider "" +fullsend self-update # or download the release +fullsend github setup "$OWNER/$REPO" ``` +The re-run opens one setup PR. That PR moves the shim trigger from +`pull_request_target` to `pull_request` and updates the workflow pin to the +CLI's release. The re-run also rewrites the repository variables and secrets +from `.fullsend/config.yaml`. When the file sets no `inference.project` or +`inference.wif_provider`, the existing GCP secret stays as it is. + +The re-run keeps your configuration. It does not rewrite +`.fullsend/config.yaml`, and a custom `FULLSEND_APP_SET` repository variable +stays as it is. + +Add flags only in these cases: + +- **The install used `--vendor` or `--fullsend-ref`.** Pass the same flag + again. A re-run without `--vendor` removes the vendored assets. +- **A value is set only as a repository variable.** A value such as + `FULLSEND_MINT_URL` or `FULLSEND_GCP_REGION` that is set as a repository + variable but not in `config.yaml` goes back to the `config.yaml` value or + the default. Put the value in `config.yaml`, or pass its flag + (`--mint-url`, `--inference-region`). +- **You want to change a configuration key.** Passing a config flag, such as + `--runtime` or `--inference-project`, changes that key in `config.yaml`. + Setup then re-serializes the file, so its comments are lost. See + [Re-running per-repo setup](../../cli/github.md#github-setup). + +`fullsend repos install` needs a manifest. A repository set up with +`github setup` and not declared in a manifest upgrades with the bare re-run +above. + For manifest-managed installations (including GitLab repos), use `repos install` to converge all repos (including workflow ref upgrades): ```bash diff --git a/docs/guides/getting-started/repo-management.md b/docs/guides/getting-started/repo-management.md index e371d92ddc..bad1fb9aca 100644 --- a/docs/guides/getting-started/repo-management.md +++ b/docs/guides/getting-started/repo-management.md @@ -1010,17 +1010,34 @@ December 2, 2026. Repositories whose `.github/workflows/fullsend.yaml` still triggers on it lose automatic review and retro from that date. Triage, `/fs-*` commands (including `/fs-review`) and the fix loop keep working. -Upgrade every public repository before that date, using the steps in -[Rolling out a new fullsend version](#rolling-out-a-new-fullsend-version). +Upgrade every public repository before that date. Use the route that matches +how the repository was set up: + +- **Repositories declared in a manifest:** run `fullsend repos install`, + using the steps in + [Rolling out a new fullsend version](#rolling-out-a-new-fullsend-version). + It rewrites the trigger and the workflow pin in one commit. If it cannot + fetch the templates of the new version, it upgrades only the pin and prints + `template fetch at the target ref failed: delivering the pin upgrade only; + run install again to deliver template changes`. Run it again once the + fetch works to deliver the trigger. +- **Single repositories set up with `fullsend github setup`:** `repos install` + needs a manifest, so upgrade the CLI and re-run setup with no flags: + + ```bash + fullsend self-update # or download the release + fullsend github setup "$OWNER/$REPO" + ``` + + The re-run opens one setup PR that rewrites the trigger and the workflow + pin, and it keeps `.fullsend/config.yaml`. See + [Syncing workflow templates](operations.md#syncing-workflow-templates) for + what the re-run changes and when to add flags. + Private and internal repositories are not blocked, and a shim that is not upgraded keeps working there (the warning appears only in public repositories). Any upgrade to a fullsend version with the new shim installs -the same `pull_request` shim, with the effects below. -`fullsend repos install` rewrites the trigger and the workflow pin in one -commit. If it cannot fetch the templates of the new version, it upgrades -only the pin and prints `template fetch at the target ref failed: delivering -the pin upgrade only; run install again to deliver template changes`. Run it -again once the fetch works to deliver the trigger. After the upgrade: +the same `pull_request` shim, with the effects below. After the upgrade: - **Same-repo PRs** are reviewed automatically, as before, except while the PR has a merge conflict: GitHub does not run `pull_request` workflows until diff --git a/internal/cli/github_test.go b/internal/cli/github_test.go index 8d76a7e115..c50fb6a5bc 100644 --- a/internal/cli/github_test.go +++ b/internal/cli/github_test.go @@ -14,6 +14,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "gopkg.in/yaml.v3" "github.com/fullsend-ai/fullsend/internal/appsetup" "github.com/fullsend-ai/fullsend/internal/config" @@ -1589,6 +1590,69 @@ func TestRunGitHubSetupPerRepo_Rerun_KeepsExistingConfigVerbatim(t *testing.T) { assert.NotContains(t, out.String(), "runtime?", "no runtime prompt on a re-run") } +// oldPullRequestTargetShim is a shim as releases before the move to +// pull_request installed it: PR events trigger on pull_request_target and +// the reusable workflow is pinned to an older release. +const oldPullRequestTargetShim = `name: fullsend + +on: + issues: + types: [opened, edited, labeled] + issue_comment: + types: [created] + pull_request_target: + types: [opened, synchronize, ready_for_review, closed, labeled, unlabeled] + pull_request_review: + types: [submitted] + +permissions: {} + +jobs: + dispatch: + if: github.event_name != 'pull_request_target' || github.event.pull_request.head.repo.full_name == github.repository + uses: fullsend-ai/fullsend/.github/workflows/reusable-dispatch.yml@v0.56.1 + secrets: inherit +` + +// TestRunGitHubSetupPerRepo_Rerun_UpgradesPullRequestTargetShim covers the +// documented single-repo upgrade (#9715): a bare re-run of github setup on a +// repo without a manifest moves the shim from pull_request_target to +// pull_request in one setup commit and keeps .fullsend/config.yaml. +func TestRunGitHubSetupPerRepo_Rerun_UpgradesPullRequestTargetShim(t *testing.T) { + t.Setenv("GH_TOKEN", "test-token") + client := newRerunSetupClient(t, existingPerRepoConfigForRerun) + client.FileContents["acme/widget/.github/workflows/fullsend.yaml"] = []byte(oldPullRequestTargetShim) + printer := ui.New(&discardWriter{}) + + err := runGitHubSetupPerRepo(context.Background(), client, printer, githubSetupConfig{ + target: "acme/widget", + agents: strings.Join(config.PerRepoDefaultRoles(), ","), + changedFlags: map[string]bool{}, + }) + require.NoError(t, err) + require.Len(t, client.CommittedFilesToBranch, 1, "the upgrade is delivered in one setup commit") + + shim, present := committedScaffoldFile(client, ".github/workflows/fullsend.yaml") + require.True(t, present, "the setup commit delivers the shim") + var wf struct { + On map[string]any `yaml:"on"` + Jobs map[string]struct { + If string `yaml:"if"` + Uses string `yaml:"uses"` + } `yaml:"jobs"` + } + require.NoError(t, yaml.Unmarshal(shim, &wf)) + assert.Contains(t, wf.On, "pull_request", "the upgraded shim triggers on pull_request") + assert.NotContains(t, wf.On, "pull_request_target", "the upgraded shim no longer triggers on pull_request_target") + dispatch, ok := wf.Jobs["dispatch"] + require.True(t, ok, "dispatch job not found") + assert.NotContains(t, dispatch.If, "pull_request_target") + assert.NotContains(t, dispatch.Uses, "@v0.56.1", "the workflow pin moves off the old release") + + _, cfgPresent := committedScaffoldFile(client, ".fullsend/config.yaml") + assert.False(t, cfgPresent, "the upgrade does not commit .fullsend/config.yaml") +} + func TestRunGitHubSetupPerRepo_Rerun_ChangesOnlyTheFlaggedKey(t *testing.T) { t.Setenv("GH_TOKEN", "test-token") client := newRerunSetupClient(t, existingPerRepoConfigForRerun) From 98a0ac7aad4730d2507c37117e1c8f7f7519b219 Mon Sep 17 00:00:00 2001 From: Wayne Sun Date: Thu, 19 Nov 2026 16:14:48 -0500 Subject: [PATCH 2/2] docs(#9715): single-repo upgrade walkthrough, run-time effects, stronger test - operations.md: "Upgrading a single repository" as a numbered walkthrough (prerequisites, dry run, re-run, merge the PR) with the real output and PR diff of a v0.56.1 upgrade. - cli/github.md: one "Re-running per-repo setup" section. Says variables and secrets are written when the command runs, and vendored assets are deleted by a separate default-branch commit without --vendor; adds --config, a safe --fullsend-ref rule and the partial GCP secret case. - repo-management.md: single-repo route is a short link. - Test pins the release ref, asserts one PR and that the old shim is replaced, and says setup renders the shim from the template. Assisted-by: Claude (fix, review), DeepSeek (review), Gemini (prose review) Signed-off-by: Wayne Sun --- docs/cli/github.md | 56 ++++++------ docs/guides/getting-started/operations.md | 90 ++++++++++++------- .../guides/getting-started/repo-management.md | 17 ++-- internal/cli/github_test.go | 17 +++- 4 files changed, 102 insertions(+), 78 deletions(-) diff --git a/docs/cli/github.md b/docs/cli/github.md index 4b1ec0f9fc..9173d15a8d 100644 --- a/docs/cli/github.md +++ b/docs/cli/github.md @@ -30,38 +30,34 @@ fullsend github setup \ The values passed to `--inference-gateway-*` and `--openai-*` come from the gateway operator and the OpenAI organization admin; see [Using an inference gateway](../guides/user/inference-gateway.md) and [OpenAI Workload Identity](../guides/infrastructure/openai-workload-identity.md). -**Re-running per-repo setup** with no flags is the supported way to upgrade a single repository -that is not declared in a [`fullsend repos`](repos.md) manifest. `fullsend repos install` needs a -manifest. Upgrade the CLI, then run: +### Re-running per-repo setup -```bash -fullsend self-update # or download the release -fullsend github setup "$OWNER/$REPO" -``` +A re-run with no flags is the supported way to upgrade a single repository that is not declared in a [`fullsend repos`](repos.md) manifest, because `fullsend repos install` needs one. The steps are in [Upgrading a single repository](../guides/getting-started/operations.md#upgrading-a-single-repository). + +**What the re-run changes:** + +| Change | When it takes effect | +|---|---| +| Managed workflow files, including the shim trigger (`pull_request_target` → `pull_request`) and the workflow pins (moved to the CLI's release, or to `--fullsend-ref`) | In one setup PR, when you merge it | +| Repository variables and secrets, resolved from the repository's configuration (`.fullsend/config.yaml` over `config.base.yaml` over compiled defaults) | When the command runs, before the PR is merged | +| Vendored assets, when the re-run has no `--vendor` | Deleted by a separate commit on the default branch when the command runs | + +Run with `--dry-run` first: it lists the files it would commit, the variable values it would set and the vendored assets it would remove. + +**What the re-run keeps:** +- An existing `.fullsend/config.yaml`: `agents:` entries and their settings, allowlists and hand-written comments stay as they are. The runtime prompt is skipped, and the setup PR reports the runtime the file selects. A `config.yaml` that no longer parses fails the re-run rather than being regenerated. +- `config.base.yaml`, unchanged. Only `--config` refreshes it. +- A custom `FULLSEND_APP_SET` repository variable. +- Existing GCP secrets for `inference.project` and `inference.wif_provider` when the configuration does not set them. When the configuration sets one of the two but not the other, the re-run reuses the other's existing secret and fails with `--inference-wif-provider is required for per-repo setup (no existing secret found)` (or the `--inference-project` equivalent) when that secret is missing. + +**When to add flags:** +- **`--vendor`:** pass it again if the install is vendored, or the re-run deletes the vendored assets. +- **`--config` (and `--config-hash`):** pass them again to refresh `config.base.yaml` from the preset. +- **`--fullsend-ref`:** pass it only with a ref at or after the release that installs the `pull_request` shim. An older ref pins the new shim to a reusable workflow that predates it. Without the flag the pins move to the CLI's release. +- **A value set only as a repository variable,** such as `FULLSEND_MINT_URL` or `FULLSEND_GCP_REGION`, goes back to the configuration value or the default. Put it in `config.yaml`, or pass its flag (`--mint-url`, `--inference-region`). +- **A config flag** (`--runtime`, `--agents`, `--mint-url`, `--inference-*`) changes that key on the existing `config.yaml` and keeps the rest. The file is re-serialized, so its comments are lost. -The re-run opens one setup PR that moves the shim trigger from `pull_request_target` to -`pull_request` and updates the workflow pin to the CLI's release. It also rewrites the repository -variables and secrets from `.fullsend/config.yaml`. A custom `FULLSEND_APP_SET` repository variable -stays as it is. Re-pass `--vendor` or `--fullsend-ref` if the install used them: a re-run without -`--vendor` removes the vendored assets. A value set only as a repository variable, such as -`FULLSEND_MINT_URL` or `FULLSEND_GCP_REGION`, and not in `config.yaml` goes back to the -`config.yaml` value or the default. Put it in `config.yaml`, or pass its flag. - -A re-run refreshes the managed -workflow files but never rewrites an existing `.fullsend/config.yaml` on its own: `agents:` entries and -their per-agent settings, allowlists and hand-written comments stay as they are, the runtime prompt is skipped, -and the setup PR reports the runtime the file already selects. Passing a flag that targets a -config key — `--runtime`, `--agents`, `--mint-url`, `--inference-*` — changes that key on the -existing file and keeps the rest (the file is re-serialized, so comments are not preserved in -that case). `--config` rewrites `config.base.yaml` from the preset (byte-for-byte) and keeps -the existing overlay unless a persistent setup flag is also passed, in which case that flag is -written into the overlay. Persistent setup flags may be combined with `--config`; they override -the corresponding preset values. When an explicitly passed persistent flag equals the value the -overlay would otherwise inherit from `config.base.yaml` or a compiled default, setup still writes -it and warns that the key is now pinned locally and will not receive later changes from that -layer. Remove the key from `.fullsend/config.yaml` to inherit again. Omitted flags and per-run -flags (`--dry-run`, `--direct`, `--vendor`, …) do not pin or warn. A `config.yaml` that no longer -parses fails the re-run rather than being regenerated. +**How `--config` and config flags combine:** `--config` rewrites `config.base.yaml` from the preset (byte-for-byte) and keeps the existing overlay unless a persistent setup flag is also passed, in which case that flag is written into the overlay. Persistent setup flags may be combined with `--config`; they override the corresponding preset values. When an explicitly passed persistent flag equals the value the overlay would otherwise inherit from `config.base.yaml` or a compiled default, setup still writes it and warns that the key is now pinned locally and will not receive later changes from that layer. Remove the key from `.fullsend/config.yaml` to inherit again. Omitted flags and per-run flags (`--dry-run`, `--direct`, `--vendor`, ...) do not pin or warn. ### Flags diff --git a/docs/guides/getting-started/operations.md b/docs/guides/getting-started/operations.md index 3d6bc13875..cb1c09990c 100644 --- a/docs/guides/getting-started/operations.md +++ b/docs/guides/getting-started/operations.md @@ -116,42 +116,66 @@ To upgrade the fullsend CLI, download the latest release from [GitHub Releases](https://github.com/fullsend-ai/fullsend/releases), or run [`fullsend self-update`](../../cli/self-update.md) on v0.55.0 or later. -To upgrade a single repository set up with `fullsend github setup`, upgrade -the CLI and re-run `github setup` with no flags. This bare re-run is the -supported single-repo upgrade: +### Upgrading a single repository -```bash -fullsend self-update # or download the release -fullsend github setup "$OWNER/$REPO" +Use this route for a repository set up with `fullsend github setup` and not declared in a `repos.yaml` manifest. `fullsend repos install` needs a manifest; manifest repositories follow [Upgrading manifest-managed repositories](#upgrading-manifest-managed-repositories) below. + +**You need:** admin access to the repository, and GitHub CLI authentication (`gh auth login`, or `GH_TOKEN` set) with the `repo` and `workflow` scopes. + +1. Upgrade the CLI: + + ```bash + fullsend self-update # or download the release + ``` + +2. Preview the re-run. It changes nothing: + + ```bash + fullsend github setup "$OWNER/$REPO" --dry-run + ``` + + Check the repository variables it lists. Variables and secrets are written as soon as step 3 runs, before you merge anything. A `FULLSEND_MINT_URL` or `FULLSEND_GCP_REGION` that you set only as a repository variable goes back to the configuration value or the default; put it in `.fullsend/config.yaml` first. If the install is vendored (the repository has `.fullsend/bin/`), add `--vendor` in step 3; without it the vendored assets are deleted from the default branch right away. + +3. Re-run setup with no flags (add `--vendor` for a vendored install): + + ```bash + fullsend github setup "$OWNER/$REPO" + ``` + +4. Review and merge the setup PR it prints. The default branch keeps the old shim until you merge. + +**What success looks like.** Output from upgrading a v0.56.1 install (shortened, repository name replaced): + +``` +→ Setting up per-repo fullsend for owner/repo + + Keeping existing .fullsend/config.yaml unchanged (pass --runtime, --agents, --mint-url or --inference-* to change a key) + • Checking token permissions + ✓ Token permissions verified + + • Creating scaffold PR for owner/repo (target: main) + ✓ Created PR #2: https://github.com/owner/repo/pull/2 + Merge the PR to apply these changes + • Configuring repository variables + ✓ Set 5 repository variables + • Configuring repository secrets + ✓ Set 2 repository secrets + + ✓ Per-repo setup complete for owner/repo ``` -The re-run opens one setup PR. That PR moves the shim trigger from -`pull_request_target` to `pull_request` and updates the workflow pin to the -CLI's release. The re-run also rewrites the repository variables and secrets -from `.fullsend/config.yaml`. When the file sets no `inference.project` or -`inference.wif_provider`, the existing GCP secret stays as it is. - -The re-run keeps your configuration. It does not rewrite -`.fullsend/config.yaml`, and a custom `FULLSEND_APP_SET` repository variable -stays as it is. - -Add flags only in these cases: - -- **The install used `--vendor` or `--fullsend-ref`.** Pass the same flag - again. A re-run without `--vendor` removes the vendored assets. -- **A value is set only as a repository variable.** A value such as - `FULLSEND_MINT_URL` or `FULLSEND_GCP_REGION` that is set as a repository - variable but not in `config.yaml` goes back to the `config.yaml` value or - the default. Put the value in `config.yaml`, or pass its flag - (`--mint-url`, `--inference-region`). -- **You want to change a configuration key.** Passing a config flag, such as - `--runtime` or `--inference-project`, changes that key in `config.yaml`. - Setup then re-serializes the file, so its comments are lost. See - [Re-running per-repo setup](../../cli/github.md#github-setup). - -`fullsend repos install` needs a manifest. A repository set up with -`github setup` and not declared in a manifest upgrades with the bare re-run -above. +The PR has one commit. It moves the shim trigger and the workflow pins, and leaves `.fullsend/config.yaml` alone: + +```diff +- pull_request_target: ++ pull_request: +- uses: fullsend-ai/fullsend/.github/workflows/reusable-dispatch.yml@27c1d6ce1d384fa8b85b6789653fb3505d93c9d3 # v0.56.1 ++ uses: fullsend-ai/fullsend/.github/workflows/reusable-dispatch.yml@f24e7d3bb03c44371e58653f0fd051ed9c445b0f # v0.57.0 +``` + +Add other flags only if the install used `--config` or `--fullsend-ref`, or to change a configuration key; see [Re-running per-repo setup](../../cli/github.md#re-running-per-repo-setup). + +### Upgrading manifest-managed repositories For manifest-managed installations (including GitLab repos), use `repos install` to converge all repos (including workflow ref upgrades): diff --git a/docs/guides/getting-started/repo-management.md b/docs/guides/getting-started/repo-management.md index bad1fb9aca..2fc5e31b83 100644 --- a/docs/guides/getting-started/repo-management.md +++ b/docs/guides/getting-started/repo-management.md @@ -1021,18 +1021,11 @@ how the repository was set up: `template fetch at the target ref failed: delivering the pin upgrade only; run install again to deliver template changes`. Run it again once the fetch works to deliver the trigger. -- **Single repositories set up with `fullsend github setup`:** `repos install` - needs a manifest, so upgrade the CLI and re-run setup with no flags: - - ```bash - fullsend self-update # or download the release - fullsend github setup "$OWNER/$REPO" - ``` - - The re-run opens one setup PR that rewrites the trigger and the workflow - pin, and it keeps `.fullsend/config.yaml`. See - [Syncing workflow templates](operations.md#syncing-workflow-templates) for - what the re-run changes and when to add flags. +- **Single repositories set up with `fullsend github setup`** and no manifest: + upgrade the CLI, re-run `fullsend github setup "$OWNER/$REPO"` with no + flags, and merge the setup PR it opens. Follow + [Upgrading a single repository](operations.md#upgrading-a-single-repository): + the re-run writes repository variables before the PR merges. Private and internal repositories are not blocked, and a shim that is not upgraded keeps working there (the warning appears only in public diff --git a/internal/cli/github_test.go b/internal/cli/github_test.go index c50fb6a5bc..9db119f2d8 100644 --- a/internal/cli/github_test.go +++ b/internal/cli/github_test.go @@ -1616,10 +1616,18 @@ jobs: // TestRunGitHubSetupPerRepo_Rerun_UpgradesPullRequestTargetShim covers the // documented single-repo upgrade (#9715): a bare re-run of github setup on a -// repo without a manifest moves the shim from pull_request_target to -// pull_request in one setup commit and keeps .fullsend/config.yaml. +// repo without a manifest, whose shim still triggers on pull_request_target, +// opens one setup PR whose single commit carries the pull_request shim pinned +// to this CLI's release, and leaves .fullsend/config.yaml out. Setup renders +// the shim from the embedded template and never reads the existing one, so +// the fixture only models the repository being upgraded; the assertions pin +// the result. func TestRunGitHubSetupPerRepo_Rerun_UpgradesPullRequestTargetShim(t *testing.T) { t.Setenv("GH_TOKEN", "test-token") + const releaseSHA = "0123456789abcdef0123456789abcdef01234567" + origOverride := upstreamRefOverride + upstreamRefOverride = releaseSHA + t.Cleanup(func() { upstreamRefOverride = origOverride }) client := newRerunSetupClient(t, existingPerRepoConfigForRerun) client.FileContents["acme/widget/.github/workflows/fullsend.yaml"] = []byte(oldPullRequestTargetShim) printer := ui.New(&discardWriter{}) @@ -1631,9 +1639,11 @@ func TestRunGitHubSetupPerRepo_Rerun_UpgradesPullRequestTargetShim(t *testing.T) }) require.NoError(t, err) require.Len(t, client.CommittedFilesToBranch, 1, "the upgrade is delivered in one setup commit") + require.Len(t, client.CreatedProposals, 1, "the upgrade opens one setup PR") shim, present := committedScaffoldFile(client, ".github/workflows/fullsend.yaml") require.True(t, present, "the setup commit delivers the shim") + assert.NotEqual(t, oldPullRequestTargetShim, string(shim), "the old shim is replaced") var wf struct { On map[string]any `yaml:"on"` Jobs map[string]struct { @@ -1647,7 +1657,8 @@ func TestRunGitHubSetupPerRepo_Rerun_UpgradesPullRequestTargetShim(t *testing.T) dispatch, ok := wf.Jobs["dispatch"] require.True(t, ok, "dispatch job not found") assert.NotContains(t, dispatch.If, "pull_request_target") - assert.NotContains(t, dispatch.Uses, "@v0.56.1", "the workflow pin moves off the old release") + assert.True(t, strings.HasSuffix(dispatch.Uses, "/reusable-dispatch.yml@"+releaseSHA), + "the workflow pin moves to the CLI's release, got %q", dispatch.Uses) _, cfgPresent := committedScaffoldFile(client, ".fullsend/config.yaml") assert.False(t, cfgPresent, "the upgrade does not commit .fullsend/config.yaml")