Skip to content

Commit 69218a8

Browse files
authored
Merge branch 'main' into patch-1
2 parents c1d3b2d + d4b2a8b commit 69218a8

File tree

413 files changed

+28776
-8435
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

413 files changed

+28776
-8435
lines changed

.github/pull_request_template.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
**Please ensure you have read the [contribution guide](https://github.com/google/adk-python/blob/main/CONTRIBUTING.md) before creating a pull request.**
2+
3+
### Link to Issue or Description of Change
4+
5+
**1. Link to an existing issue (if applicable):**
6+
7+
- Closes: #_issue_number_
8+
- Related: #_issue_number_
9+
10+
**2. Or, if no issue exists, describe the change:**
11+
12+
_If applicable, please follow the issue templates to provide as much detail as
13+
possible._
14+
15+
**Problem:**
16+
_A clear and concise description of what the problem is._
17+
18+
**Solution:**
19+
_A clear and concise description of what you want to happen and why you choose
20+
this solution._
21+
22+
### Testing Plan
23+
24+
_Please describe the tests that you ran to verify your changes. This is required
25+
for all PRs that are not small documentation or typo fixes._
26+
27+
**Unit Tests:**
28+
29+
- [ ] I have added or updated unit tests for my change.
30+
- [ ] All unit tests pass locally.
31+
32+
_Please include a summary of passed `pytest` results._
33+
34+
**Manual End-to-End (E2E) Tests:**
35+
36+
_Please provide instructions on how to manually test your changes, including any
37+
necessary setup or configuration. Please provide logs or screenshots to help
38+
reviewers better understand the fix._
39+
40+
### Checklist
41+
42+
- [ ] I have read the [CONTRIBUTING.md](https://github.com/google/adk-python/blob/main/CONTRIBUTING.md) document.
43+
- [ ] I have performed a self-review of my own code.
44+
- [ ] I have commented my code, particularly in hard-to-understand areas.
45+
- [ ] I have added tests that prove my fix is effective or that my feature works.
46+
- [ ] New and existing unit tests pass locally with my changes.
47+
- [ ] I have manually tested my changes end-to-end.
48+
- [ ] Any dependent changes have been merged and published in downstream modules.
49+
50+
### Additional context
51+
52+
_Add any other context or screenshots about the feature request here._

.github/workflows/check-file-contents.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
- name: Check for import from cli package in certain changed Python files
9090
run: |
9191
git fetch origin ${{ github.base_ref }}
92-
CHANGED_FILES=$(git diff --diff-filter=ACMR --name-only origin/${{ github.base_ref }}...HEAD | grep -E '\.py$' | grep -v -E 'cli/.*|tests/.*|contributing/samples/' || true)
92+
CHANGED_FILES=$(git diff --diff-filter=ACMR --name-only origin/${{ github.base_ref }}...HEAD | grep -E '\.py$' | grep -v -E 'cli/.*|src/google/adk/tools/apihub_tool/apihub_toolset.py|tests/.*|contributing/samples/' || true)
9393
if [ -n "$CHANGED_FILES" ]; then
9494
echo "Changed Python files to check:"
9595
echo "$CHANGED_FILES"
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
name: Copybara PR Handler
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
inputs:
9+
pr_number:
10+
description: 'PR number to close (for testing)'
11+
required: true
12+
type: string
13+
commit_sha:
14+
description: 'Commit SHA reference (optional, for testing)'
15+
required: false
16+
type: string
17+
18+
jobs:
19+
close-imported-pr:
20+
runs-on: ubuntu-latest
21+
permissions:
22+
pull-requests: write
23+
issues: write
24+
contents: read
25+
26+
steps:
27+
- name: Check for Copybara commits and close PRs
28+
uses: actions/github-script@v7
29+
with:
30+
github-token: ${{ secrets.ADK_TRIAGE_AGENT }}
31+
script: |
32+
// Check if this is a manual test run
33+
const isManualRun = context.eventName === 'workflow_dispatch';
34+
35+
let prsToClose = [];
36+
37+
if (isManualRun) {
38+
// Manual testing mode
39+
const prNumber = parseInt(context.payload.inputs.pr_number);
40+
const commitSha = context.payload.inputs.commit_sha || context.sha.substring(0, 7);
41+
42+
console.log('=== MANUAL TEST MODE ===');
43+
console.log(`Testing with PR #${prNumber}, commit ${commitSha}`);
44+
45+
prsToClose.push({ prNumber, commitSha });
46+
} else {
47+
// Normal mode: process commits from push event
48+
const commits = context.payload.commits || [];
49+
console.log(`Found ${commits.length} commit(s) in this push`);
50+
51+
// Process each commit
52+
for (const commit of commits) {
53+
const sha = commit.id;
54+
const committer = commit.committer.name;
55+
const message = commit.message;
56+
57+
console.log(`\n--- Processing commit ${sha.substring(0, 7)} ---`);
58+
console.log(`Committer: ${committer}`);
59+
60+
// Check if this is a Copybara commit
61+
if (committer !== 'Copybara-Service') {
62+
console.log('Not a Copybara commit, skipping');
63+
continue;
64+
}
65+
66+
// Extract PR number from commit message
67+
// Pattern: "Merge https://github.com/google/adk-python/pull/3333"
68+
const prMatch = message.match(/Merge https:\/\/github\.com\/google\/adk-python\/pull\/(\d+)/);
69+
70+
if (!prMatch) {
71+
console.log('No PR number found in Copybara commit message');
72+
continue;
73+
}
74+
75+
const prNumber = parseInt(prMatch[1]);
76+
const commitSha = sha.substring(0, 7);
77+
78+
prsToClose.push({ prNumber, commitSha });
79+
}
80+
}
81+
82+
// Process PRs to close
83+
for (const { prNumber, commitSha } of prsToClose) {
84+
console.log(`\n--- Processing PR #${prNumber} ---`);
85+
86+
// Get PR details to check if it's open
87+
let pr;
88+
try {
89+
pr = await github.rest.pulls.get({
90+
owner: context.repo.owner,
91+
repo: context.repo.repo,
92+
pull_number: prNumber
93+
});
94+
} catch (error) {
95+
console.log(`PR #${prNumber} not found or inaccessible:`, error.message);
96+
continue;
97+
}
98+
99+
// Only close if PR is still open
100+
if (pr.data.state !== 'open') {
101+
console.log(`PR #${prNumber} is already ${pr.data.state}, skipping`);
102+
continue;
103+
}
104+
105+
const author = pr.data.user.login;
106+
107+
try {
108+
// Add comment with commit reference
109+
await github.rest.issues.createComment({
110+
owner: context.repo.owner,
111+
repo: context.repo.repo,
112+
issue_number: prNumber,
113+
body: `Thank you @${author} for your contribution! 🎉\n\nYour changes have been successfully imported and merged via Copybara in commit ${commitSha}.\n\nClosing this PR as the changes are now in the main branch.`
114+
});
115+
116+
// Close the PR
117+
await github.rest.pulls.update({
118+
owner: context.repo.owner,
119+
repo: context.repo.repo,
120+
pull_number: prNumber,
121+
state: 'closed'
122+
});
123+
124+
console.log(`Successfully closed PR #${prNumber}`);
125+
} catch (error) {
126+
console.log(`Error closing PR #${prNumber}:`, error.message);
127+
}
128+
}
129+
130+
if (isManualRun) {
131+
console.log('\n=== TEST COMPLETED ===');
132+
} else {
133+
console.log('\n--- Finished processing all commits ---');
134+
}

.github/workflows/pr-triage.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@ name: ADK Pull Request Triaging Agent
33
on:
44
pull_request_target:
55
types: [opened, reopened, edited]
6+
workflow_dispatch:
7+
inputs:
8+
pr_number:
9+
description: 'The Pull Request number to triage'
10+
required: true
11+
type: 'string'
612

713
jobs:
814
agent-triage-pull-request:
9-
if: "!contains(github.event.pull_request.labels.*.name, 'bot triaged') && !contains(github.event.pull_request.labels.*.name, 'google-contributor')"
15+
if: github.event_name == 'workflow_dispatch' || !contains(github.event.pull_request.labels.*.name, 'google-contributor')
1016
runs-on: ubuntu-latest
1117
permissions:
1218
pull-requests: write
@@ -33,7 +39,7 @@ jobs:
3339
GOOGLE_GENAI_USE_VERTEXAI: 0
3440
OWNER: 'google'
3541
REPO: 'adk-python'
36-
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
42+
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number || github.event.inputs.pr_number }}
3743
INTERACTIVE: ${{ vars.PR_TRIAGE_INTERACTIVE }}
3844
PYTHONPATH: contributing/samples
3945
run: python -m adk_pr_triaging_agent.main

.github/workflows/triage.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ name: ADK Issue Triaging Agent
33
on:
44
issues:
55
types: [opened, reopened]
6-
schedule:
7-
- cron: '0 */6 * * *' # every 6h
86

97
jobs:
108
agent-triage-issues:

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,20 @@ Thumbs.db
9898
*.bak
9999
*.tmp
100100
*.temp
101+
102+
# AI Coding Tools - Project-specific configs
103+
# Developers should symlink or copy AGENTS.md and add their own overrides locally
104+
.claude/
105+
CLAUDE.md
106+
.cursor/
107+
.cursorrules
108+
.cursorignore
109+
.windsurfrules
110+
.aider*
111+
.continue/
112+
.codeium/
113+
.githubnext/
114+
.roo/
115+
.rooignore
116+
.bolt/
117+
.v0/

0 commit comments

Comments
 (0)