Skip to content

Commit 68c5ef5

Browse files
brunoborgesCopilot
andcommitted
Add CI workflow to validate agentic workflow compilation
Adds validate-agentic-workflows.yml that runs on PRs touching workflows/. Uses gh-aw CLI setup action to install the compiler, then runs 'gh aw compile --validate' on each workflow .md file. Posts a sticky PR comment with fix instructions on failure. Also adds workflows/** to validate-readme.yml path triggers so README tables are regenerated when workflows change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 7f69ba5 commit 68c5ef5

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Validate Agentic Workflows
2+
3+
on:
4+
pull_request:
5+
branches: [staged]
6+
types: [opened, synchronize, reopened]
7+
paths:
8+
- "workflows/**"
9+
10+
permissions:
11+
contents: read
12+
pull-requests: write
13+
14+
jobs:
15+
validate-workflows:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Install gh-aw CLI
22+
uses: github/gh-aw/actions/setup-cli@main
23+
24+
- name: Find and compile workflow files
25+
id: compile
26+
run: |
27+
exit_code=0
28+
found=0
29+
30+
# Find all .md files in workflows/ subfolders (excluding README.md)
31+
for workflow_file in workflows/*/*.md; do
32+
[ -f "$workflow_file" ] || continue
33+
basename=$(basename "$workflow_file")
34+
[ "$basename" = "README.md" ] && continue
35+
36+
found=$((found + 1))
37+
echo "::group::Compiling $workflow_file"
38+
if gh aw compile --validate "$workflow_file"; then
39+
echo "✅ $workflow_file compiled successfully"
40+
else
41+
echo "❌ $workflow_file failed to compile"
42+
exit_code=1
43+
fi
44+
echo "::endgroup::"
45+
done
46+
47+
if [ "$found" -eq 0 ]; then
48+
echo "No workflow .md files found to validate (README.md files are excluded)."
49+
else
50+
echo "Validated $found workflow file(s)."
51+
fi
52+
53+
echo "status=$( [ $exit_code -eq 0 ] && echo success || echo failure )" >> "$GITHUB_OUTPUT"
54+
exit $exit_code
55+
56+
- name: Comment on PR if compilation failed
57+
if: failure()
58+
uses: marocchino/sticky-pull-request-comment@v2
59+
with:
60+
header: workflow-validation
61+
message: |
62+
## ❌ Agentic Workflow compilation failed
63+
64+
One or more workflow files in `workflows/` failed to compile with `gh aw compile --validate`.
65+
66+
Please fix the errors and push again. You can test locally with:
67+
68+
```bash
69+
gh extension install github/gh-aw
70+
gh aw compile --validate <your-workflow-file>.md
71+
```
72+
73+
See the [Agentic Workflows documentation](https://github.github.com/gh-aw) for help.

.github/workflows/validate-readme.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
- "prompts/**"
1010
- "agents/**"
1111
- "plugins/**"
12+
- "workflows/**"
1213
- "*.js"
1314
- "README.md"
1415
- "docs/**"

0 commit comments

Comments
 (0)