Skip to content

Commit 54756ed

Browse files
committed
Expand codegen agentic fix workflow to also fix java.ts
--- ## Summary Updates the `codegen-agentic-fix` gh-aw workflow so the agent can modify `scripts/codegen/java.ts` when schema changes require code generator fixes, not just handwritten SDK/test code. This reflects the lesson learned from the 1.0.35 update: when `@github/copilot` schemas change structurally (e.g. inline types → `$ref` references), the code generator itself must be updated before the generated output is correct. ## Changes ### Modified files - **`.github/workflows/codegen-agentic-fix.md`** — Rewrote the agent prompt: - Added architecture overview explaining the codegen pipeline - Added Step 2 (Diagnose) to distinguish codegen vs handwritten failures - Added Step 3 (Fix code generator) with instructions to read schemas, fix `java.ts`, and re-run generation - Expanded constraints: `java.ts` is now explicitly allowed; blanket `scripts/codegen/` ban replaced with targeted rules - Added prominent warning against directly editing `src/generated/` - Documented common schema change patterns ($ref, field type changes, renamed properties) from the 1.0.35 experience - **`.github/workflows/agentics-maintenance.yml`** — Lockfile regenerated by `gh aw compile` (updated hash for changed manifest) - **`.github/aw/actions-lock.json`** — Updated by `gh aw compile`
1 parent 5f8ae27 commit 54756ed

3 files changed

Lines changed: 374 additions & 34 deletions

File tree

.github/aw/actions-lock.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
"version": "v4",
2121
"sha": "49933ea5288caeca8642d1e84afbd3f7d6820020"
2222
},
23+
"github/gh-aw-actions/setup-cli@v0.68.3": {
24+
"repo": "github/gh-aw-actions/setup-cli",
25+
"version": "v0.68.3",
26+
"sha": "ba90f2186d7ad780ec640f364005fa24e797b360"
27+
},
2328
"github/gh-aw-actions/setup@v0.68.3": {
2429
"repo": "github/gh-aw-actions/setup",
2530
"version": "v0.68.3",

.github/workflows/agentics-maintenance.yml

Lines changed: 268 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#
21
# ___ _ _
32
# / _ \ | | (_)
43
# | |_| | __ _ ___ _ __ | |_ _ ___
@@ -13,7 +12,7 @@
1312
# \ /\ / (_) | | | | ( | | | | (_) \ V V /\__ \
1413
# \/ \/ \___/|_| |_|\_\|_| |_|\___/ \_/\_/ |___/
1514
#
16-
# This file was automatically generated by pkg/workflow/maintenance_workflow.go (v0.51.6). DO NOT EDIT.
15+
# This file was automatically generated by pkg/workflow/maintenance_workflow.go (v0.68.3). DO NOT EDIT.
1716
#
1817
# To regenerate this workflow, run:
1918
# gh aw compile
@@ -37,46 +36,298 @@ on:
3736
schedule:
3837
- cron: "37 0 * * *" # Daily (based on minimum expires: 6 days)
3938
workflow_dispatch:
39+
inputs:
40+
operation:
41+
description: 'Optional maintenance operation to run'
42+
required: false
43+
type: choice
44+
default: ''
45+
options:
46+
- ''
47+
- 'disable'
48+
- 'enable'
49+
- 'update'
50+
- 'upgrade'
51+
- 'safe_outputs'
52+
- 'create_labels'
53+
- 'clean_cache_memories'
54+
- 'validate'
55+
run_url:
56+
description: 'Run URL or run ID to replay safe outputs from (e.g. https://github.com/owner/repo/actions/runs/12345 or 12345). Required when operation is safe_outputs.'
57+
required: false
58+
type: string
59+
default: ''
60+
workflow_call:
61+
inputs:
62+
operation:
63+
description: 'Optional maintenance operation to run (disable, enable, update, upgrade, safe_outputs, create_labels, clean_cache_memories, validate)'
64+
required: false
65+
type: string
66+
default: ''
67+
run_url:
68+
description: 'Run URL or run ID to replay safe outputs from (e.g. https://github.com/owner/repo/actions/runs/12345 or 12345). Required when operation is safe_outputs.'
69+
required: false
70+
type: string
71+
default: ''
72+
outputs:
73+
operation_completed:
74+
description: 'The maintenance operation that was completed (empty when none ran or a scheduled job ran)'
75+
value: ${{ jobs.run_operation.outputs.operation || inputs.operation }}
76+
applied_run_url:
77+
description: 'The run URL that safe outputs were applied from'
78+
value: ${{ jobs.apply_safe_outputs.outputs.run_url }}
4079

4180
permissions: {}
4281

4382
jobs:
4483
close-expired-entities:
45-
if: ${{ !github.event.repository.fork }}
84+
if: ${{ (!(github.event.repository.fork)) && (github.event_name != 'workflow_dispatch' && github.event_name != 'workflow_call' || inputs.operation == '') }}
4685
runs-on: ubuntu-slim
4786
permissions:
4887
discussions: write
4988
issues: write
5089
pull-requests: write
5190
steps:
5291
- name: Setup Scripts
53-
uses: github/gh-aw/actions/setup@33cd6c7f1fee588654ef19def2e6a4174be66197 # v0.51.6
92+
uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
5493
with:
55-
destination: /opt/gh-aw/actions
94+
destination: ${{ runner.temp }}/gh-aw/actions
5695

5796
- name: Close expired discussions
58-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
97+
uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
5998
with:
6099
script: |
61-
const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs');
62-
setupGlobals(core, github, context, exec, io);
63-
const { main } = require('/opt/gh-aw/actions/close_expired_discussions.cjs');
100+
const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
101+
setupGlobals(core, github, context, exec, io, getOctokit);
102+
const { main } = require('${{ runner.temp }}/gh-aw/actions/close_expired_discussions.cjs');
64103
await main();
65104
66105
- name: Close expired issues
67-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
106+
uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
68107
with:
69108
script: |
70-
const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs');
71-
setupGlobals(core, github, context, exec, io);
72-
const { main } = require('/opt/gh-aw/actions/close_expired_issues.cjs');
109+
const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
110+
setupGlobals(core, github, context, exec, io, getOctokit);
111+
const { main } = require('${{ runner.temp }}/gh-aw/actions/close_expired_issues.cjs');
73112
await main();
74113
75114
- name: Close expired pull requests
76-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
115+
uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
116+
with:
117+
script: |
118+
const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
119+
setupGlobals(core, github, context, exec, io, getOctokit);
120+
const { main } = require('${{ runner.temp }}/gh-aw/actions/close_expired_pull_requests.cjs');
121+
await main();
122+
123+
cleanup-cache-memory:
124+
if: ${{ (!(github.event.repository.fork)) && (github.event_name != 'workflow_dispatch' && github.event_name != 'workflow_call' || inputs.operation == '' || inputs.operation == 'clean_cache_memories') }}
125+
runs-on: ubuntu-slim
126+
permissions:
127+
actions: write
128+
steps:
129+
- name: Setup Scripts
130+
uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
131+
with:
132+
destination: ${{ runner.temp }}/gh-aw/actions
133+
134+
- name: Cleanup outdated cache-memory entries
135+
uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
136+
with:
137+
script: |
138+
const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
139+
setupGlobals(core, github, context, exec, io, getOctokit);
140+
const { main } = require('${{ runner.temp }}/gh-aw/actions/cleanup_cache_memory.cjs');
141+
await main();
142+
143+
run_operation:
144+
if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation != '' && inputs.operation != 'safe_outputs' && inputs.operation != 'create_labels' && inputs.operation != 'clean_cache_memories' && inputs.operation != 'validate' && (!(github.event.repository.fork)) }}
145+
runs-on: ubuntu-slim
146+
permissions:
147+
actions: write
148+
contents: write
149+
pull-requests: write
150+
outputs:
151+
operation: ${{ steps.record.outputs.operation }}
152+
steps:
153+
- name: Checkout repository
154+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
155+
with:
156+
persist-credentials: false
157+
158+
- name: Setup Scripts
159+
uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
160+
with:
161+
destination: ${{ runner.temp }}/gh-aw/actions
162+
163+
- name: Check admin/maintainer permissions
164+
uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
165+
with:
166+
github-token: ${{ secrets.GITHUB_TOKEN }}
167+
script: |
168+
const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
169+
setupGlobals(core, github, context, exec, io, getOctokit);
170+
const { main } = require('${{ runner.temp }}/gh-aw/actions/check_team_member.cjs');
171+
await main();
172+
173+
- name: Install gh-aw
174+
uses: github/gh-aw-actions/setup-cli@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
175+
with:
176+
version: v0.68.3
177+
178+
- name: Run operation
179+
uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
180+
env:
181+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
182+
GH_AW_OPERATION: ${{ inputs.operation }}
183+
GH_AW_CMD_PREFIX: gh aw
184+
with:
185+
github-token: ${{ secrets.GITHUB_TOKEN }}
186+
script: |
187+
const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
188+
setupGlobals(core, github, context, exec, io, getOctokit);
189+
const { main } = require('${{ runner.temp }}/gh-aw/actions/run_operation_update_upgrade.cjs');
190+
await main();
191+
192+
- name: Record outputs
193+
id: record
194+
run: echo "operation=${{ inputs.operation }}" >> "$GITHUB_OUTPUT"
195+
196+
apply_safe_outputs:
197+
if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation == 'safe_outputs' && (!(github.event.repository.fork)) }}
198+
runs-on: ubuntu-slim
199+
permissions:
200+
actions: read
201+
contents: write
202+
discussions: write
203+
issues: write
204+
pull-requests: write
205+
outputs:
206+
run_url: ${{ steps.record.outputs.run_url }}
207+
steps:
208+
- name: Checkout actions folder
209+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
210+
with:
211+
sparse-checkout: |
212+
actions
213+
persist-credentials: false
214+
215+
- name: Setup Scripts
216+
uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
217+
with:
218+
destination: ${{ runner.temp }}/gh-aw/actions
219+
220+
- name: Check admin/maintainer permissions
221+
uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
222+
with:
223+
github-token: ${{ secrets.GITHUB_TOKEN }}
224+
script: |
225+
const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
226+
setupGlobals(core, github, context, exec, io, getOctokit);
227+
const { main } = require('${{ runner.temp }}/gh-aw/actions/check_team_member.cjs');
228+
await main();
229+
230+
- name: Apply Safe Outputs
231+
uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
232+
env:
233+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
234+
GH_AW_RUN_URL: ${{ inputs.run_url }}
235+
with:
236+
github-token: ${{ secrets.GITHUB_TOKEN }}
237+
script: |
238+
const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
239+
setupGlobals(core, github, context, exec, io, getOctokit);
240+
const { main } = require('${{ runner.temp }}/gh-aw/actions/apply_safe_outputs_replay.cjs');
241+
await main();
242+
243+
- name: Record outputs
244+
id: record
245+
run: echo "run_url=${{ inputs.run_url }}" >> "$GITHUB_OUTPUT"
246+
247+
create_labels:
248+
if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation == 'create_labels' && (!(github.event.repository.fork)) }}
249+
runs-on: ubuntu-slim
250+
permissions:
251+
contents: read
252+
issues: write
253+
steps:
254+
- name: Checkout repository
255+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
256+
with:
257+
persist-credentials: false
258+
259+
- name: Setup Scripts
260+
uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
261+
with:
262+
destination: ${{ runner.temp }}/gh-aw/actions
263+
264+
- name: Check admin/maintainer permissions
265+
uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
266+
with:
267+
github-token: ${{ secrets.GITHUB_TOKEN }}
268+
script: |
269+
const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
270+
setupGlobals(core, github, context, exec, io, getOctokit);
271+
const { main } = require('${{ runner.temp }}/gh-aw/actions/check_team_member.cjs');
272+
await main();
273+
274+
- name: Install gh-aw
275+
uses: github/gh-aw-actions/setup-cli@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
276+
with:
277+
version: v0.68.3
278+
279+
- name: Create missing labels
280+
uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
281+
env:
282+
GH_AW_CMD_PREFIX: gh aw
283+
with:
284+
github-token: ${{ secrets.GITHUB_TOKEN }}
285+
script: |
286+
const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
287+
setupGlobals(core, github, context, exec, io, getOctokit);
288+
const { main } = require('${{ runner.temp }}/gh-aw/actions/create_labels.cjs');
289+
await main();
290+
291+
validate_workflows:
292+
if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation == 'validate' && (!(github.event.repository.fork)) }}
293+
runs-on: ubuntu-latest
294+
permissions:
295+
contents: read
296+
issues: write
297+
steps:
298+
- name: Checkout repository
299+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
300+
with:
301+
persist-credentials: false
302+
303+
- name: Setup Scripts
304+
uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
305+
with:
306+
destination: ${{ runner.temp }}/gh-aw/actions
307+
308+
- name: Check admin/maintainer permissions
309+
uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
310+
with:
311+
github-token: ${{ secrets.GITHUB_TOKEN }}
312+
script: |
313+
const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
314+
setupGlobals(core, github, context, exec, io, getOctokit);
315+
const { main } = require('${{ runner.temp }}/gh-aw/actions/check_team_member.cjs');
316+
await main();
317+
318+
- name: Install gh-aw
319+
uses: github/gh-aw-actions/setup-cli@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
320+
with:
321+
version: v0.68.3
322+
323+
- name: Validate workflows and file issue on findings
324+
uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
325+
env:
326+
GH_AW_CMD_PREFIX: gh aw
77327
with:
328+
github-token: ${{ secrets.GITHUB_TOKEN }}
78329
script: |
79-
const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs');
80-
setupGlobals(core, github, context, exec, io);
81-
const { main } = require('/opt/gh-aw/actions/close_expired_pull_requests.cjs');
330+
const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
331+
setupGlobals(core, github, context, exec, io, getOctokit);
332+
const { main } = require('${{ runner.temp }}/gh-aw/actions/run_validate_workflows.cjs');
82333
await main();

0 commit comments

Comments
 (0)