Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/update-a2a-types.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Update A2A Schema from Specification

on:
schedule:
- cron: "0 0 * * *" # Runs daily at 00:00 UTC
workflow_dispatch:

jobs:
check_and_update:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"

- 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: Run datamodel-codegen
run: |
set -euo pipefail # Exit immediately if a command exits with a non-zero status

REMOTE_URL="https://raw.githubusercontent.com/google/A2A/refs/heads/main/specification/json/a2a.json"
GENERATED_FILE="${{ steps.vars.outputs.GENERATED_FILE }}"

echo "Running datamodel-codegen..."
uv run datamodel-codegen \
--url "$REMOTE_URL" \
--input-file-type jsonschema \
--output "$GENERATED_FILE" \
--target-python-version 3.10 \
--output-model-type pydantic_v2.BaseModel \
--disable-timestamp \
--use-schema-description \
--use-union-operator \
--use-field-description \
--use-default \
--use-default-kwarg \
--use-one-literal-as-default \
--class-name A2A \
--use-standard-collections
echo "Codegen finished."

- name: Create Pull Request if generated file changed
uses: peter-evans/create-pull-request@v6
with:
committer: a2a-bot <a2a-bot@google.com>
author: a2a-bot <a2a-bot@google.com>
commit-message: "chore: 🤖 Auto-update A2A schema from specification"
title: "chore: 🤖 Auto-update A2A Schema from Specification"
body: |
This PR automatically updates the A2A schema types based on the latest specification.

This update was triggered by the scheduled workflow run.
See the workflow run details: [${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
branch: "a2a-schema-update"
base: main
labels: |
automated
dependencies
add-paths: ${{ steps.vars.outputs.GENERATED_FILE }}
Loading