Skip to content

Commit 29a9b2a

Browse files
Enforce gh aw compile + lock-file regeneration for agentic workflows (#4298)
1 parent 793d5ad commit 29a9b2a

2 files changed

Lines changed: 81 additions & 0 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
applyTo: ".github/workflows/**/*.md"
3+
description: Rules for editing gh-aw agentic workflow Markdown files.
4+
---
5+
6+
# Agentic Workflow Edit Rules (`gh aw`)
7+
8+
This repository authors GitHub Actions agentic workflows in Markdown using
9+
[`gh aw`](https://github.com/githubnext/gh-aw). Each workflow `.md` file under
10+
`.github/workflows/` compiles to a sibling `.lock.yml`, and **only the
11+
`.lock.yml` is executed by GitHub Actions at runtime.**
12+
13+
## Mandatory rule
14+
15+
Whenever you create, edit, rename, or delete a file matching
16+
`.github/workflows/**/*.md`, you **MUST**, in the **same commit / PR**:
17+
18+
1. Run `gh aw compile` from the repository root.
19+
2. Stage and commit the regenerated sibling `<name>.lock.yml`.
20+
3. If you deleted a workflow `.md`, also delete its `.lock.yml`.
21+
22+
If the `.lock.yml` is stale or missing, the workflow fails at runtime
23+
(see PR #4279 for the exact failure mode). The
24+
`Verify gh aw lock files` CI check will block the PR in that case.
25+
26+
## How to verify locally
27+
28+
```bash
29+
gh aw compile
30+
git status # both the .md and .lock.yml should appear
31+
gh aw compile # second run must be a no-op (clean diff)
32+
```
33+
34+
## Code-review checklist
35+
36+
When reviewing a PR that touches `.github/workflows/**/*.md`:
37+
38+
- [ ] A matching `.lock.yml` is updated in the same PR.
39+
- [ ] `gh aw compile` produces no further diff on top of the PR.
40+
- [ ] If new tools, network endpoints, or permissions are added in the `.md`,
41+
they are present in the regenerated `.lock.yml`.
42+
43+
## Out of scope
44+
45+
- Do **not** hand-edit `.lock.yml` files. They are generated; edit the `.md`
46+
source and recompile.
47+
- For deeper authoring guidance (creating, debugging, upgrading workflows),
48+
invoke the `agentic-workflows` agent at
49+
`.github/agents/agentic-workflows.agent.md`.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Verify gh aw lock files
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '.github/workflows/**/*.md'
7+
- '.github/workflows/**/*.lock.yml'
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
verify:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Install gh-aw extension
19+
uses: github/gh-aw-actions/setup-cli@bc56a0cad2f450c562810785ef38649c04db812a # v0.72.1
20+
with:
21+
version: v0.72.1
22+
23+
- name: Recompile agentic workflows
24+
run: gh aw compile
25+
26+
- name: Fail if any .lock.yml is out of date
27+
run: |
28+
if ! git diff --exit-code -- '.github/workflows/**/*.lock.yml'; then
29+
echo "::error::One or more .github/workflows/**/*.lock.yml files are out of date relative to their .md source (running 'gh aw compile' produced a diff)."
30+
echo "::error::Run 'gh aw compile' locally and commit the regenerated .lock.yml files in this PR."
31+
exit 1
32+
fi

0 commit comments

Comments
 (0)