Skip to content

Commit 4933617

Browse files
committed
chore: run middleware patch in PR
1 parent 7a2c4a2 commit 4933617

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Apply middleware patch in PR
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
patch:
12+
if: github.head_ref == 'codex/generated-middleware-pipeline'
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 30
15+
steps:
16+
- uses: actions/checkout@v6
17+
with:
18+
ref: ${{ github.head_ref }}
19+
fetch-depth: 0
20+
- uses: actions/setup-go@v6
21+
with:
22+
go-version-file: go.mod
23+
cache: true
24+
- name: Execute the reviewed patch body
25+
shell: bash
26+
run: |
27+
python3 - <<'PY'
28+
from pathlib import Path
29+
30+
source = Path('.github/workflows/codex-generated-middleware-patch.yml').read_text().splitlines()
31+
start = next(index for index, line in enumerate(source) if line == " python3 - <<'PY'")
32+
end = next(index for index in range(start + 1, len(source)) if source[index] == " PY")
33+
block = [line[10:] if line.startswith(' ') else line for line in source[start:end + 1]]
34+
35+
gofmt_start = next(index for index in range(end + 1, len(source)) if source[index] == ' gofmt -w \\')
36+
gofmt_end = gofmt_start
37+
while gofmt_end + 1 < len(source) and source[gofmt_end].rstrip().endswith('\\'):
38+
gofmt_end += 1
39+
block.extend(line[10:] if line.startswith(' ') else line for line in source[gofmt_start:gofmt_end + 1])
40+
Path('/tmp/apply-generated-middleware-patch.sh').write_text('\n'.join(block) + '\n')
41+
PY
42+
bash /tmp/apply-generated-middleware-patch.sh
43+
- name: Regenerate appgen golden output
44+
run: go test ./internal/appgen -update
45+
- name: Run focused tests
46+
run: go test ./internal/appgen ./runtime/app
47+
- name: Commit implementation
48+
shell: bash
49+
run: |
50+
git diff --check
51+
rm -f \
52+
.github/workflows/codex-generated-middleware-patch.yml \
53+
.github/workflows/codex-pr-patch.yml \
54+
.codex-generated-middleware-trigger
55+
git config user.name "github-actions[bot]"
56+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
57+
git add -A
58+
git commit -m "fix(appgen): wrap the finalized route graph with middleware"
59+
git push origin HEAD:codex/generated-middleware-pipeline

0 commit comments

Comments
 (0)