Skip to content

feat: Convert fields in types.py to use snake_case #46

feat: Convert fields in types.py to use snake_case

feat: Convert fields in types.py to use snake_case #46

name: Update A2A Schema from Specification
on:
repository_dispatch:
types: [a2a_json_update]
workflow_dispatch:
pull_request:
branches:
- main
paths:
- "scripts/generate_types.sh"
- "src/a2a/pydantic_base.py"
types:
- opened
- synchronize
- reopened
jobs:
generate_and_pr:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Configure uv shell
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install dependencies (datamodel-code-generator)
run: uv sync
- name: Define output file variable
id: vars
run: |
GENERATED_FILE="./src/a2a/types.py"
echo "GENERATED_FILE=$GENERATED_FILE" >> "$GITHUB_OUTPUT"
- name: Generate types from schema
run: |
chmod +x scripts/generate_types.sh
./scripts/generate_types.sh "${{ steps.vars.outputs.GENERATED_FILE }}"
- name: Install Buf
uses: bufbuild/buf-setup-action@v1
- name: Run buf generate
run: |
set -euo pipefail # Exit immediately if a command exits with a non-zero status
echo "Running buf generate..."
buf generate
uv run scripts/grpc_gen_post_processor.py
echo "Buf generate finished."
- name: Commit changes to current PR
if: github.event_name == 'pull_request' # Only run this step for pull_request events
run: |
git config user.name "a2a-bot"
git config user.email "[email protected]"
git add ${{ steps.vars.outputs.GENERATED_FILE }} src/a2a/grpc/
git diff --cached --exit-code || git commit -m "feat: Update A2A types from specification 🤖"
git push
env:
GITHUB_TOKEN: ${{ secrets.A2A_BOT_PAT }}
- name: Create Pull Request with Updates (for repository_dispatch/workflow_dispatch)
if: github.event_name != 'pull_request'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.A2A_BOT_PAT }}
committer: "a2a-bot <[email protected]>"
author: "a2a-bot <[email protected]>"
commit-message: "feat: Update A2A types from specification 🤖"
title: "feat: Update A2A types from specification 🤖"
body: |
This PR updates `src/a2a/types.py` based on the latest `specification/json/a2a.json` from [google-a2a/A2A](https://github.com/google-a2a/A2A/commit/${{ github.event.client_payload.sha }}).
branch: "auto-update-a2a-types-${{ github.event.client_payload.sha }}"
base: main
labels: |
automated
dependencies
add-paths: |
${{ steps.vars.outputs.GENERATED_FILE }}
src/a2a/grpc/