Support Required || ADK 2.0 Graph Based Workflow Deployment on Agent Engine #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright 2026 Google LLC | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| name: ADK Issue Fix Implementation | |
| on: | |
| issue_comment: | |
| types: [created] | |
| workflow_dispatch: | |
| inputs: | |
| issue_url: | |
| description: 'The URL of the GitHub issue to fix' | |
| required: true | |
| type: string | |
| jobs: | |
| issue-fix: | |
| if: >- | |
| github.repository == 'google/adk-python' && ( | |
| github.event_name == 'workflow_dispatch' || | |
| (github.event_name == 'issue_comment' && | |
| !github.event.issue.pull_request && | |
| startsWith(github.event.comment.body, '/adk-issue-fix') && ( | |
| github.event.comment.author_association == 'OWNER' || | |
| github.event.comment.author_association == 'MEMBER' || | |
| github.event.comment.author_association == 'COLLABORATOR' | |
| )) | |
| ) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| token: ${{ secrets.ADK_TRIAGE_AGENT }} | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.11' | |
| - name: Authenticate to Google Cloud | |
| id: auth | |
| uses: 'google-github-actions/auth@v3' | |
| with: | |
| credentials_json: '${{ secrets.ADK_GCP_SA_KEY }}' | |
| - name: Install Google Antigravity SDK | |
| run: pip install google-antigravity | |
| - name: Run Antigravity Fix | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.ADK_TRIAGE_AGENT }} | |
| GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} | |
| run: | | |
| python scripts/run_antigravity.py "/adk-issue-fix ${{ github.event.issue.html_url || inputs.issue_url }}" | |
| - name: Check for changes and create Pull Request | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.ADK_TRIAGE_AGENT }} | |
| GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} | |
| run: | | |
| if [ -n "$(git status --porcelain)" ]; then | |
| echo "Changes detected in workspace. Committing and creating Pull Request..." | |
| # Setup git configs | |
| git config --local user.name "adk-bot" | |
| git config --local user.email "adk-bot@google.com" | |
| # Extract issue number and export it for python | |
| ISSUE_URL="${{ github.event.issue.html_url || inputs.issue_url }}" | |
| export ISSUE_NUMBER=$(echo "$ISSUE_URL" | grep -oP '/issues/\K[0-9]+') | |
| # Determine branch name to push | |
| CURRENT_BRANCH=$(git branch --show-current) | |
| EXPECTED_BRANCH="fix/issue-${ISSUE_NUMBER}" | |
| if [ "$CURRENT_BRANCH" != "$EXPECTED_BRANCH" ]; then | |
| echo "Error: Current branch is '$CURRENT_BRANCH', but expected '$EXPECTED_BRANCH'." | |
| echo "The Antigravity Agent was expected to create and checkout '$EXPECTED_BRANCH'." | |
| exit 1 | |
| fi | |
| BRANCH_NAME="$CURRENT_BRANCH" | |
| # Run Antigravity to stage and commit changes with autogenerated message | |
| python scripts/run_antigravity.py "Analyze the unstaged changes in the workspace, stage all of them, and commit them using git. Generate a highly precise conventional commit message based on the diff." | |
| # Append the closes tag using Python to avoid relying on LLM formatting | |
| python -c "import os, subprocess; msg = subprocess.check_output(['git', 'log', '-1', '--pretty=%B'], text=True); tag = 'closes https://github.com/google/adk-python/issues/' + os.environ['ISSUE_NUMBER']; subprocess.run(['git', 'commit', '--amend', '-m', msg.strip() + '\n\n' + tag], check=True) if tag not in msg else None" | |
| # Retrieve the username of the authenticated user | |
| BOT_USER=$(gh api user --jq .login) | |
| echo "Authenticated bot user is $BOT_USER" | |
| # Ensure the fork exists | |
| gh repo fork google/adk-python --clone=false || true | |
| # Push the branch to the bot fork | |
| git remote add fork "https://x-access-token:${{ secrets.ADK_TRIAGE_AGENT }}@github.com/${BOT_USER}/adk-python.git" | |
| git push fork "$BRANCH_NAME" --force | |
| # Retrieve the commit message of the last commit | |
| COMMIT_MSG=$(git log -1 --pretty=%B) | |
| # Create PR from the bot fork to the main repository | |
| gh pr create \ | |
| --repo google/adk-python \ | |
| --title "fix(issue): fix issue #${ISSUE_NUMBER}" \ | |
| --body "$COMMIT_MSG" \ | |
| --head "${BOT_USER}:$BRANCH_NAME" \ | |
| --base "main" | |
| else | |
| echo "No changes made by the agent. Skipping PR creation." | |
| fi |