Commit e35f776
authored
ci(format): fix checkout for fork PRs (CopilotKit#5164)
## Problem
The `format` job sets `ref: github.head_ref` but leaves `repository:`
unset, so it checks the head branch out of the **base** repo. For fork
PRs the head branch only exists on the fork, so checkout fails before
formatting even runs.
Seen on CopilotKit#5099 (fork PR, branch `fix/5072`):
```
##[error]A branch or tag with the name 'fix/5072' could not be found
```
## Fix
Resolve `repository` to the head repo on PRs, matching `ref`:
```yaml
ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
repository: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}
```
Same-repo PRs are unchanged (head repo == base repo), so the auto-format
push-back still works.1 file changed
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
43 | 49 | | |
44 | 50 | | |
45 | 51 | | |
| |||
0 commit comments