mirror of
https://github.com/github/awesome-copilot.git
synced 2026-02-24 12:25:11 +00:00
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>
This commit is contained in:
73
.github/workflows/validate-agentic-workflows.yml
vendored
Normal file
73
.github/workflows/validate-agentic-workflows.yml
vendored
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
name: Validate Agentic Workflows
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: [staged]
|
||||||
|
types: [opened, synchronize, reopened]
|
||||||
|
paths:
|
||||||
|
- "workflows/**"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
validate-workflows:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install gh-aw CLI
|
||||||
|
uses: github/gh-aw/actions/setup-cli@main
|
||||||
|
|
||||||
|
- name: Find and compile workflow files
|
||||||
|
id: compile
|
||||||
|
run: |
|
||||||
|
exit_code=0
|
||||||
|
found=0
|
||||||
|
|
||||||
|
# Find all .md files in workflows/ subfolders (excluding README.md)
|
||||||
|
for workflow_file in workflows/*/*.md; do
|
||||||
|
[ -f "$workflow_file" ] || continue
|
||||||
|
basename=$(basename "$workflow_file")
|
||||||
|
[ "$basename" = "README.md" ] && continue
|
||||||
|
|
||||||
|
found=$((found + 1))
|
||||||
|
echo "::group::Compiling $workflow_file"
|
||||||
|
if gh aw compile --validate "$workflow_file"; then
|
||||||
|
echo "✅ $workflow_file compiled successfully"
|
||||||
|
else
|
||||||
|
echo "❌ $workflow_file failed to compile"
|
||||||
|
exit_code=1
|
||||||
|
fi
|
||||||
|
echo "::endgroup::"
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$found" -eq 0 ]; then
|
||||||
|
echo "No workflow .md files found to validate (README.md files are excluded)."
|
||||||
|
else
|
||||||
|
echo "Validated $found workflow file(s)."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "status=$( [ $exit_code -eq 0 ] && echo success || echo failure )" >> "$GITHUB_OUTPUT"
|
||||||
|
exit $exit_code
|
||||||
|
|
||||||
|
- name: Comment on PR if compilation failed
|
||||||
|
if: failure()
|
||||||
|
uses: marocchino/sticky-pull-request-comment@v2
|
||||||
|
with:
|
||||||
|
header: workflow-validation
|
||||||
|
message: |
|
||||||
|
## ❌ Agentic Workflow compilation failed
|
||||||
|
|
||||||
|
One or more workflow files in `workflows/` failed to compile with `gh aw compile --validate`.
|
||||||
|
|
||||||
|
Please fix the errors and push again. You can test locally with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gh extension install github/gh-aw
|
||||||
|
gh aw compile --validate <your-workflow-file>.md
|
||||||
|
```
|
||||||
|
|
||||||
|
See the [Agentic Workflows documentation](https://github.github.com/gh-aw) for help.
|
||||||
1
.github/workflows/validate-readme.yml
vendored
1
.github/workflows/validate-readme.yml
vendored
@@ -9,6 +9,7 @@ on:
|
|||||||
- "prompts/**"
|
- "prompts/**"
|
||||||
- "agents/**"
|
- "agents/**"
|
||||||
- "plugins/**"
|
- "plugins/**"
|
||||||
|
- "workflows/**"
|
||||||
- "*.js"
|
- "*.js"
|
||||||
- "README.md"
|
- "README.md"
|
||||||
- "docs/**"
|
- "docs/**"
|
||||||
|
|||||||
Reference in New Issue
Block a user