Skip to content

Commit dbd4bb0

Browse files
xuanyang15copybara-github
authored andcommitted
docs: Add manual batch mode trigger for ADK Pull Request Triaging workflow
Co-authored-by: Xuan Yang <xygoogle@google.com> PiperOrigin-RevId: 936929363
1 parent 816a87f commit dbd4bb0

3 files changed

Lines changed: 18 additions & 13 deletions

File tree

.github/workflows/pr-triage.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,24 @@
1515
name: ADK Pull Request Triaging Agent
1616

1717
on:
18-
pull_request_target:
19-
types: [opened, reopened, edited]
2018
schedule:
2119
# Run every 6 hours
2220
- cron: '0 */6 * * *'
2321
workflow_dispatch:
2422
inputs:
2523
pr_number:
26-
description: 'The Pull Request number to triage'
27-
required: true
24+
description: 'The Pull Request number to triage (leave empty for batch mode)'
25+
required: false
26+
type: 'string'
27+
pr_count:
28+
description: 'Number of PRs to process in batch mode (default: 10)'
29+
required: false
30+
default: '10'
2831
type: 'string'
2932

3033
jobs:
3134
agent-triage-pull-request:
32-
if: >-
33-
github.event_name == 'schedule' ||
34-
github.event_name == 'workflow_dispatch' || (
35-
github.event.pull_request.head.repo.full_name == github.repository &&
36-
!contains(github.event.pull_request.labels.*.name, 'google-contributor')
37-
)
35+
if: github.repository == 'google/adk-python'
3836
runs-on: ubuntu-latest
3937
permissions:
4038
pull-requests: write
@@ -62,6 +60,7 @@ jobs:
6260
OWNER: 'google'
6361
REPO: 'adk-python'
6462
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number || github.event.inputs.pr_number || '' }}
63+
PR_COUNT_TO_PROCESS: ${{ github.event.inputs.pr_count || '10' }}
6564
INTERACTIVE: ${{ vars.PR_TRIAGE_INTERACTIVE }}
6665
PYTHONPATH: contributing/samples/adk_team
6766
run: python -m adk_pr_triaging_agent.main

contributing/samples/adk_team/adk_pr_triaging_agent/main.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
from adk_pr_triaging_agent import agent
2020
from adk_pr_triaging_agent.settings import OWNER
21+
from adk_pr_triaging_agent.settings import PR_COUNT_TO_PROCESS
2122
from adk_pr_triaging_agent.settings import PULL_REQUEST_NUMBER
2223
from adk_pr_triaging_agent.settings import REPO
2324
from adk_pr_triaging_agent.utils import call_agent_async
@@ -44,10 +45,14 @@ async def main():
4445
if pr_number:
4546
prompt = f"Please triage pull request #{pr_number}!"
4647
else:
47-
print("No pull request number received. Operating in batch mode.")
48+
pr_count = parse_number_string(PR_COUNT_TO_PROCESS, default_value=10)
49+
print(
50+
"No pull request number received. Operating in batch mode (limit:"
51+
f" {pr_count})."
52+
)
4853
prompt = (
49-
"Please use 'list_untriaged_pull_requests' to find 10 pull requests"
50-
" that need triaging, then triage each one according to your"
54+
f"Please use 'list_untriaged_pull_requests' to find {pr_count} pull"
55+
" requests that need triaging, then triage each one according to your"
5156
" instructions."
5257
)
5358

contributing/samples/adk_team/adk_pr_triaging_agent/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@
2828
OWNER = os.getenv("OWNER", "google")
2929
REPO = os.getenv("REPO", "adk-python")
3030
PULL_REQUEST_NUMBER = os.getenv("PULL_REQUEST_NUMBER")
31+
PR_COUNT_TO_PROCESS = os.getenv("PR_COUNT_TO_PROCESS", "10")
3132

3233
IS_INTERACTIVE = os.environ.get("INTERACTIVE", "1").lower() in ["true", "1"]

0 commit comments

Comments
 (0)