Skip to content

Commit 03afd47

Browse files
docs: Update table header in Workflow.md for clarity and consistency
1 parent 55314fe commit 03afd47

2 files changed

Lines changed: 104 additions & 1 deletion

File tree

src/docs/Ways-of-Working/Issue-Format.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,109 @@ Issues use [GitHub Flavored Markdown](https://github.github.com/gfm/) with the f
154154
- `[text](url)` links for all external references.
155155
- **No hard line breaks within a paragraph.** GitHub renders mid-paragraph newlines as spaces, which creates inconsistent visual spacing.
156156

157+
## Examples
158+
159+
### Feature issue
160+
161+
**Title:** `Add pagination support to Get-GitHubRepository`
162+
163+
**Labels:** `Minor`, `Feature`
164+
165+
**Description:**
166+
167+
```markdown
168+
A developer using Get-GitHubRepository to list all repositories in a large organization
169+
receives only the first 30 results. There is no way to request additional pages or
170+
automatically retrieve all results.
171+
172+
The function should support automatic pagination so that all repositories are returned
173+
by default, with an optional parameter to limit the number of results.
174+
175+
**Acceptance criteria:**
176+
177+
- Calling `Get-GitHubRepository -Owner 'LargeOrg'` returns all repositories, not just
178+
the first page.
179+
- A `-First` parameter limits the total number of results returned.
180+
- Pagination follows the `Link` header pattern used by the GitHub REST API.
181+
182+
---
183+
184+
**Pagination strategy:** Follow the `Link` response header. Parse `rel="next"` and
185+
continue requesting until no next link is present. This matches the approach already
186+
used in `Get-GitHubRelease`.
187+
188+
**Parameter naming:** Use `-First` (consistent with PowerShell conventions and
189+
`Select-Object -First`). Considered `-Limit` but it conflicts with API terminology.
190+
191+
**Rate limiting:** No special handling — the existing retry logic in
192+
`Invoke-GitHubAPI` already respects `retry-after` headers.
193+
194+
---
195+
196+
### Core logic
197+
198+
- [ ] Add `Link` header parsing to `Invoke-GitHubAPI` (return next-page URL).
199+
- [ ] Update `Get-GitHubRepository` to loop until no next page or `-First` is reached.
200+
- [ ] Add `-First` parameter with `[int]` type and default of `0` (unlimited).
201+
202+
### Tests
203+
204+
- [ ] Unit test: `Link` header parsing returns correct next URL.
205+
- [ ] Integration test: paginated request returns more results than a single page.
206+
- [ ] Integration test: `-First 5` stops after 5 results.
207+
208+
### Documentation
209+
210+
- [ ] Update `Get-GitHubRepository` comment-based help with `-First` parameter.
211+
```
212+
213+
### Bug fix issue
214+
215+
**Title:** `Fix null reference when Context is not resolved`
216+
217+
**Labels:** `Patch`, `Bug`
218+
219+
**Description:**
220+
221+
```markdown
222+
When running `Build-PSModule` in a fresh container where the GitHub context environment
223+
variables are not set, the action fails with:
224+
225+
> InvalidOperation: You cannot call a method on a null-valued expression.
226+
227+
The error occurs on every run in that environment. Expected behaviour is a clear error
228+
message indicating that context is unavailable, not an unhandled null reference.
229+
230+
**Reproduction steps:**
231+
232+
1. Run `Build-PSModule` locally without setting `GITHUB_CONTEXT`.
233+
2. Observe the null-reference exception in the `Get-PSModuleSettings` step.
234+
235+
**Environment:** GitHub Actions runner `ubuntu-latest`, PowerShell 7.4.6.
236+
237+
**Acceptance criteria:**
238+
239+
- When `GITHUB_CONTEXT` is not set, the action terminates with a descriptive error:
240+
`"GitHub context is not available. Ensure the action runs inside a GitHub Actions workflow."`
241+
- No unhandled null-reference exception reaches the user.
242+
243+
---
244+
245+
**Guard location:** Add a null check at the top of `src/main.ps1` in Get-PSModuleSettings,
246+
before any property access on the context object. This keeps the fix close to the source
247+
and avoids scattering defensive checks throughout the codebase.
248+
249+
**Error style:** Use `throw` with a terminating error rather than `Write-Error`, because
250+
downstream steps cannot proceed without context.
251+
252+
---
253+
254+
- [ ] Add null check for `$GitHubContext` at line 12 of `src/main.ps1`.
255+
- [ ] Throw terminating error with descriptive message when null.
256+
- [ ] Add Pester test: mock empty environment, assert correct error message.
257+
- [ ] Add Pester test: mock valid environment, assert no error.
258+
```
259+
157260
## Labels
158261

159262
Labels categorize. The category is never encoded in the title.

src/docs/Ways-of-Working/Workflow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ After merge, the system is live. Monitor, observe, respond to signals. When some
132132

133133
Planning happens at different time horizons and levels of detail:
134134

135-
| | Now | Next | Later |
135+
| Level | Now | Next | Later |
136136
| ---------- | -------------------- | ------------- | -------------- |
137137
| Conceptual | Vision delivered now | Vision next | Vision later |
138138
| Logical | Approach now | Approach next | Approach later |

0 commit comments

Comments
 (0)