forked from a2aproject/A2A
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (60 loc) · 2.17 KB
/
Copy pathgenerate-a2a-json.yml
File metadata and controls
69 lines (60 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Auto-generate A2A JSON Schema
on:
pull_request:
branches:
- main
paths:
- "types/**"
types:
- opened
- synchronize
- reopened
jobs:
generate_json:
name: Generate JSON Schema
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Code
uses: actions/checkout@v5
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: "20"
- name: Install dependencies and generate a2a.json
working-directory: types
run: |
npm install
npm run generate
id: generate_schema
- name: Configure Git for Bot
if: github.event.pull_request.head.repo.full_name == github.repository
run: |
git config user.name "a2a-bot"
git config user.email "a2a-bot@google.com"
- name: Check for Changes
id: git_status
run: |
git add specification/json/a2a.json
if ! git diff --cached --quiet --exit-code; then
echo "changes_detected=true" >> "$GITHUB_OUTPUT"
echo "a2a.json is not up-to-date with types.ts"
else
echo "a2a.json is up-to-date."
fi
- name: Commit and Push Changes (if on base repository)
if: steps.git_status.outputs.changes_detected == 'true' && github.event.pull_request.head.repo.full_name == github.repository
run: |
git commit -m "chore: Auto-generate a2a.json from types.ts changes"
git push
- name: Fail on Fork PR if Changes Required
if: steps.git_status.outputs.changes_detected == 'true' && github.event.pull_request.head.repo.full_name != github.repository
run: |
echo "::error::a2a.json is out of date."
echo "Please run 'npm install' then 'npm run generate' in the 'types' directory of your branch and commit the updated 'specification/json/a2a.json' file."
exit 1 # Exit with a non-zero code to fail the workflow