Skip to content

Commit f1c850f

Browse files
Fix documentation accuracy: clarify Set-GitHubRepository issues PATCH on existing repos
1 parent a971b94 commit f1c850f

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

.github/instructions/tests.instructions.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,11 @@ Runs once before all parallel test files. For each auth case (except `GITHUB_TOK
7171
4. For `organization` owners only, provisions two extra repositories per OS (`-2`, `-3` suffix) for
7272
Secrets/Variables `SelectedRepository` tests
7373

74-
`Set-GitHubRepository` is idempotent — it returns the existing repository if it already exists, or creates
75-
it if it does not. This makes the global setup safe to re-run for the same `GITHUB_RUN_ID`.
74+
`Set-GitHubRepository` is idempotent — if the repository already exists it updates it in place (issuing a
75+
PATCH), and if it does not exist it creates it. Because the same parameters are passed each time, the
76+
end-state is identical regardless of how many times the setup runs. The extra PATCH on the happy path is
77+
a deliberate trade-off for simplicity: one call handles both first-run and partial-rerun scenarios without
78+
branching logic.
7679

7780
### `AfterAll.ps1` — global teardown
7881

@@ -84,9 +87,10 @@ Runs once after all parallel test files complete. For each auth case (except `GI
8487
## Shared test repositories
8588

8689
Each test file that depends on a GitHub repository must ensure it exists using `Set-GitHubRepository`
87-
in its per-context `BeforeAll`. `Set-GitHubRepository` is idempotent — it returns the existing repository
88-
if it already exists, or creates it if it does not. This makes every test file self-sufficient regardless
89-
of whether the global `BeforeAll.ps1` already provisioned the repository.
90+
in its per-context `BeforeAll`. `Set-GitHubRepository` is idempotent — if the repository already exists
91+
it updates it in place (PATCH), and if it does not exist it creates it. When the same parameters are
92+
passed each time the end-state is identical. This makes every test file self-sufficient regardless of
93+
whether the global `BeforeAll.ps1` already provisioned the repository.
9094

9195
**Do not** use `Get-GitHubRepository` with a throw guard — that breaks partial reruns.
9296
**Do not** use `New-GitHubRepository` — that fails if the repository already exists.

0 commit comments

Comments
 (0)