Skip to content

Commit 3168e8e

Browse files
committed
Update workflow to run whenever generate_types is edited.
1 parent b6a07f2 commit 3168e8e

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

.github/workflows/update-a2a-types.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ on:
44
repository_dispatch:
55
types: [a2a_json_update]
66
workflow_dispatch:
7+
pull_request:
8+
branches:
9+
- main
10+
paths:
11+
- "scripts/generate_types.sh"
12+
- "src/pydantic_base.py"
13+
types:
14+
- opened
15+
- synchronize
16+
- reopened
717

818
jobs:
919
generate_and_pr:
@@ -15,6 +25,9 @@ jobs:
1525
steps:
1626
- name: Checkout code
1727
uses: actions/checkout@v4
28+
with:
29+
ref: ${{ github.event.pull_request.head.ref }}
30+
repository: ${{ github.event.pull_request.head.repo.full_name }}
1831

1932
- name: Set up Python
2033
uses: actions/setup-python@v5
@@ -53,7 +66,19 @@ jobs:
5366
uv run scripts/grpc_gen_post_processor.py
5467
echo "Buf generate finished."
5568
56-
- name: Create Pull Request with Updates
69+
- name: Commit changes to current PR
70+
if: github.event_name == 'pull_request' # Only run this step for pull_request events
71+
run: |
72+
git config user.name "a2a-bot"
73+
git config user.email "[email protected]"
74+
git add ${{ steps.vars.outputs.GENERATED_FILE }} src/a2a/grpc/
75+
git diff --cached --exit-code || git commit -m "feat: Update A2A types from specification 🤖"
76+
git push
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.A2A_BOT_PAT }}
79+
80+
- name: Create Pull Request with Updates (for repository_dispatch/workflow_dispatch)
81+
if: github.event_name != 'pull_request'
5782
uses: peter-evans/create-pull-request@v6
5883
with:
5984
token: ${{ secrets.A2A_BOT_PAT }}

0 commit comments

Comments
 (0)