Skip to content

Commit fc4a953

Browse files
authored
Merge branch 'main' into firestore-session-updatereadme
2 parents c41072e + b8be90d commit fc4a953

227 files changed

Lines changed: 28310 additions & 5186 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Analyze New Release for ADK Docs Updates
2+
3+
on:
4+
# Runs on every new release.
5+
release:
6+
types: [published]
7+
# Manual trigger for testing and retrying.
8+
workflow_dispatch:
9+
inputs:
10+
start_tag:
11+
description: 'Older release tag (base), e.g. v0.1.0'
12+
required: false
13+
type: string
14+
end_tag:
15+
description: 'Newer release tag (head), e.g. v0.2.0'
16+
required: false
17+
type: string
18+
dry_run:
19+
description: 'Dry run: preview only. Set to false to actually create the issue and PRs.'
20+
required: false
21+
default: true
22+
type: boolean
23+
24+
jobs:
25+
analyze-new-release-for-adk-docs-updates:
26+
runs-on: ubuntu-latest
27+
# Dry-run reads only (this repo + the public docs repo) and skips writes, so
28+
# the built-in GITHUB_TOKEN suffices. For --no-dry-run, use a PAT with write
29+
# access to the docs repo.
30+
permissions:
31+
contents: read
32+
33+
steps:
34+
- name: Checkout repository
35+
uses: actions/checkout@v6
36+
37+
- name: Set up Java
38+
uses: actions/setup-java@v5
39+
with:
40+
distribution: temurin
41+
java-version: '17'
42+
43+
- name: Cache Maven packages
44+
uses: actions/cache@v5
45+
with:
46+
path: ~/.m2/repository
47+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
48+
restore-keys: |
49+
${{ runner.os }}-maven-
50+
51+
- name: Run the ADK Docs Release Analyzer
52+
env:
53+
# Built-in token is enough for dry-run (read-only). For --no-dry-run, use a
54+
# PAT with docs-repo write access, e.g. ${{ secrets.ADK_TRIAGE_AGENT }}.
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
57+
GOOGLE_GENAI_USE_VERTEXAI: '0'
58+
DOC_OWNER: 'google'
59+
CODE_OWNER: 'google'
60+
DOC_REPO: 'adk-docs'
61+
CODE_REPO: 'adk-java'
62+
ANALYZER_START_TAG: ${{ github.event.inputs.start_tag }}
63+
ANALYZER_END_TAG: ${{ github.event.inputs.end_tag }}
64+
# Defaults to dry-run (preview only). Flip to false via manual dispatch
65+
# to actually create the issue and PRs.
66+
ANALYZER_DRY_RUN: ${{ github.event.inputs.dry_run || 'true' }}
67+
shell: bash
68+
run: |
69+
set -euo pipefail
70+
if [[ "${ANALYZER_DRY_RUN}" == "false" ]]; then
71+
args="--no-dry-run"
72+
else
73+
args="--dry-run"
74+
fi
75+
if [[ -n "${ANALYZER_START_TAG:-}" ]]; then
76+
args="${args} --start-tag ${ANALYZER_START_TAG}"
77+
fi
78+
if [[ -n "${ANALYZER_END_TAG:-}" ]]; then
79+
args="${args} --end-tag ${ANALYZER_END_TAG}"
80+
fi
81+
# Install ADK libs + sample, then run exec:java scoped to this module
82+
# (exec:java with -am would also run on the parent, which has no mainClass).
83+
./mvnw -B -q -pl contrib/samples/github/adkreleasedocs -am install -DskipTests
84+
./mvnw -B -q -pl contrib/samples/github/adkreleasedocs exec:java \
85+
-Dexec.args="${args}"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Validates that the PR title is a Conventional Commit. Pull requests are
2+
# squash-merged into a single commit (see pr-commit-check.yml), so the PR title
3+
# becomes the commit message release-please parses for versioning and changelog
4+
# generation.
5+
name: PR Title Check
6+
7+
on:
8+
pull_request:
9+
types: [opened, edited, synchronize, reopened]
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
check-pr-title:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Validate Conventional Commit title
19+
env:
20+
PR_TITLE: ${{ github.event.pull_request.title }}
21+
run: |
22+
pattern='^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([a-zA-Z0-9][a-zA-Z0-9/]*[a-zA-Z0-9]\))?!?:.*[^.[:space:]]$'
23+
if [[ "$PR_TITLE" =~ $pattern ]]; then
24+
echo "PR title is a valid Conventional Commit: $PR_TITLE"
25+
else
26+
echo "::error::Invalid PR title: \"$PR_TITLE\""
27+
echo "Expected: <type>[(scope)][!]: <description>"
28+
echo "Allowed types: build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test"
29+
echo "The description must not be empty and must not end with a period."
30+
exit 1
31+
fi
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Triages newly-opened (and reopened/edited) adk-java pull requests with the ADK
2+
# PR Triaging Agent sample under contrib/samples/github/adkprtriaging. The agent
3+
# labels the PR and, when it falls short of the contribution guidelines, posts a
4+
# single comment asking the author for the missing context.
5+
#
6+
# Required repository secrets:
7+
# - GOOGLE_API_KEY : Gemini API key (or wire up Vertex AI credentials and
8+
# set GOOGLE_GENAI_USE_VERTEXAI=TRUE).
9+
# Labeling/commenting uses the built-in GITHUB_TOKEN (no secret to manage); the
10+
# `permissions:` block below grants it the `pull-requests: write` scope it needs.
11+
# Swap in a PAT only if you specifically want triage actions attributed to a
12+
# distinct bot identity.
13+
#
14+
# Security note: this workflow uses `pull_request_target`, so it runs with the
15+
# base repository's token/secrets. It deliberately relies on the DEFAULT checkout
16+
# (the base branch) and never checks out the PR head, so untrusted PR code is
17+
# never executed — the agent only reads the PR through the GitHub API. The agent
18+
# additionally treats the PR title/body/diff as untrusted data, binds its writes
19+
# to the triggering PR number and a fixed label allowlist, and pins writes to
20+
# this repository (see the sample's README for the full threat model).
21+
name: ADK PR Triaging Agent
22+
23+
on:
24+
pull_request_target:
25+
types: [opened, reopened, edited]
26+
workflow_dispatch:
27+
inputs:
28+
pr_number:
29+
description: 'The pull request number to triage'
30+
required: true
31+
type: 'string'
32+
dry_run:
33+
description: 'Dry run: preview only. Set to false to actually create the issue and PRs.'
34+
required: false
35+
default: true
36+
type: boolean
37+
38+
# Serialize runs that touch the same PR so a re-trigger (e.g. an "edited" event)
39+
# can't race an in-flight run on the same PR (which, with label appends, could
40+
# duplicate labels or comments).
41+
concurrency:
42+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.inputs.pr_number }}
43+
cancel-in-progress: false
44+
45+
jobs:
46+
agent-triage-pull-request:
47+
runs-on: ubuntu-latest
48+
# Only run on the upstream repo, for newly-opened/reopened/edited PRs or a
49+
# manual dispatch.
50+
if: >-
51+
github.repository == 'google/adk-java' && (
52+
github.event_name == 'workflow_dispatch' ||
53+
github.event.action == 'opened' ||
54+
github.event.action == 'reopened' ||
55+
github.event.action == 'edited'
56+
)
57+
permissions:
58+
pull-requests: write
59+
contents: read
60+
61+
steps:
62+
# Default checkout: the base branch (trusted code), NOT the PR head.
63+
- name: Checkout repository
64+
uses: actions/checkout@v6
65+
66+
- name: Set up Java
67+
uses: actions/setup-java@v5
68+
with:
69+
distribution: temurin
70+
java-version: '17'
71+
cache: maven
72+
73+
- name: Run PR Triaging Agent
74+
env:
75+
# Built-in token scoped by the `permissions:` block above. Replace with a
76+
# PAT (e.g. ${{ secrets.ADK_TRIAGE_AGENT }}) only if you need a distinct
77+
# bot identity for the label/comment actions.
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
80+
GOOGLE_GENAI_USE_VERTEXAI: '0'
81+
OWNER: ${{ github.repository_owner }}
82+
REPO: ${{ github.event.repository.name }}
83+
INTERACTIVE: '0'
84+
# Defaults to a dry run (logs intended labels/comments without writing).
85+
# Verify the pipeline, then set DRY_RUN to '0' to go live.
86+
DRY_RUN: ${{ github.event.inputs.dry_run || 'true' }}
87+
EVENT_NAME: ${{ github.event_name }}
88+
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number || github.event.inputs.pr_number }}
89+
run: |
90+
# Install the ADK libs + this sample, then run exec:java scoped to this
91+
# module (exec:java with -am would also run on the parent/core modules,
92+
# which have no mainClass).
93+
./mvnw -B -q -pl contrib/samples/github/adkprtriaging -am install -DskipTests
94+
./mvnw -B -q -pl contrib/samples/github/adkprtriaging exec:java
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Scans adk-java issues for spam/promotional content with the ADK Issue
2+
# Monitoring (Spam Detection) Agent sample under
3+
# contrib/samples/github/adkspam.
4+
#
5+
# Required repository secrets:
6+
# - GOOGLE_API_KEY : Gemini API key (or wire up Vertex AI credentials and
7+
# set GOOGLE_GENAI_USE_VERTEXAI=TRUE).
8+
# Labeling/commenting uses the built-in GITHUB_TOKEN (no secret to manage); the
9+
# `permissions:` block below grants it the `issues: write` scope it needs. Swap
10+
# in a PAT only if you specifically want the spam label/alert comment attributed
11+
# to a distinct bot identity.
12+
#
13+
# NOTE: the `spam` label (or whatever SPAM_LABEL_NAME is set to) must already
14+
# exist in the repository's labels; the agent applies it but does not create it.
15+
name: ADK Issue Monitoring (Spam Detection) Agent
16+
17+
on:
18+
issues:
19+
types: [opened]
20+
schedule:
21+
# Run daily at 06:00 UTC, matching the Python issue-monitor workflow.
22+
- cron: '0 6 * * *'
23+
workflow_dispatch:
24+
inputs:
25+
full_scan:
26+
description: 'Audit ALL open issues (not just those updated in the last 24h).'
27+
required: false
28+
default: false
29+
type: boolean
30+
dry_run:
31+
description: 'Dry run: preview only. Set to false to actually create the issue and PRs.'
32+
required: false
33+
default: true
34+
type: boolean
35+
36+
# Serialize runs that touch the same issue so the scheduled sweep can't race a
37+
# per-issue run on that issue.
38+
concurrency:
39+
group: ${{ github.workflow }}-${{ github.event.issue.number || github.ref }}
40+
cancel-in-progress: false
41+
42+
jobs:
43+
agent-scan-issues:
44+
runs-on: ubuntu-latest
45+
# Only run on the upstream repo, for newly-opened issues, the scheduled
46+
# sweep, or a manual dispatch.
47+
if: >-
48+
github.repository == 'google/adk-java' && (
49+
github.event_name == 'schedule' ||
50+
github.event_name == 'workflow_dispatch' ||
51+
github.event.action == 'opened'
52+
)
53+
permissions:
54+
issues: write
55+
contents: read
56+
57+
steps:
58+
- name: Checkout repository
59+
uses: actions/checkout@v6
60+
61+
- name: Set up Java
62+
uses: actions/setup-java@v5
63+
with:
64+
distribution: temurin
65+
java-version: '17'
66+
cache: maven
67+
68+
- name: Run Spam Detection Agent
69+
env:
70+
# Built-in token scoped by the `permissions:` block above. Replace with a
71+
# PAT (e.g. ${{ secrets.ADK_TRIAGE_AGENT }}) only if you need a distinct
72+
# bot identity for the label/comment actions.
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
75+
GOOGLE_GENAI_USE_VERTEXAI: '0'
76+
OWNER: ${{ github.repository_owner }}
77+
REPO: ${{ github.event.repository.name }}
78+
INTERACTIVE: '0'
79+
# Defaults to a dry run (logs intended labels/comments without writing).
80+
# Verify the pipeline, then set DRY_RUN to '0' to go live.
81+
DRY_RUN: ${{ github.event.inputs.dry_run || 'true' }}
82+
EVENT_NAME: ${{ github.event_name }}
83+
ISSUE_NUMBER: ${{ github.event.issue.number }}
84+
ISSUE_TITLE: ${{ github.event.issue.title }}
85+
ISSUE_BODY: ${{ github.event.issue.body }}
86+
# Mapped to the manual-dispatch checkbox. On the daily schedule this is
87+
# empty, so only issues updated in the last 24h are audited.
88+
INITIAL_FULL_SCAN: ${{ github.event.inputs.full_scan }}
89+
run: |
90+
# Install the ADK libs + this sample, then run exec:java scoped to this
91+
# module (exec:java with -am would also run on the parent/core modules,
92+
# which have no mainClass).
93+
./mvnw -B -q -pl contrib/samples/github/adkspam -am install -DskipTests
94+
./mvnw -B -q -pl contrib/samples/github/adkspam exec:java
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Audits stale adk-java issues with the ADK Stale Issue Auditor sample under
2+
# contrib/samples/github/adkstale.
3+
#
4+
# Required repository secrets:
5+
# - GOOGLE_API_KEY : Gemini API key (or wire up Vertex AI credentials and
6+
# set GOOGLE_GENAI_USE_VERTEXAI=TRUE).
7+
# Commenting/labelling/closing uses the built-in GITHUB_TOKEN (no secret to
8+
# manage); the `permissions:` block below grants it the `issues: write` scope it
9+
# needs. Swap in a PAT only if you specifically want stale actions attributed to
10+
# a distinct bot identity.
11+
#
12+
# Prerequisite: the `stale` label (and, if used, `request clarification`) must
13+
# exist in the repository; GitHub will not auto-create labels when the agent
14+
# applies them.
15+
name: ADK Stale Issue Auditor
16+
17+
on:
18+
schedule:
19+
# Run daily at 06:00 UTC.
20+
- cron: '0 6 * * *'
21+
workflow_dispatch:
22+
inputs:
23+
dry_run:
24+
description: 'Dry run: preview only. Set to false to actually create the issue and PRs.'
25+
required: false
26+
default: true
27+
type: boolean
28+
29+
# Serialize runs so an in-flight daily sweep can't overlap a manual dispatch and
30+
# act on the same issues twice.
31+
concurrency:
32+
group: ${{ github.workflow }}
33+
cancel-in-progress: false
34+
35+
jobs:
36+
agent-audit-stale-issues:
37+
runs-on: ubuntu-latest
38+
# Only run on the upstream repo, on the daily schedule or a manual dispatch.
39+
if: >-
40+
github.repository == 'google/adk-java' && (
41+
github.event_name == 'schedule' ||
42+
github.event_name == 'workflow_dispatch'
43+
)
44+
permissions:
45+
issues: write
46+
contents: read
47+
48+
steps:
49+
- name: Checkout repository
50+
uses: actions/checkout@v6
51+
52+
- name: Set up Java
53+
uses: actions/setup-java@v5
54+
with:
55+
distribution: temurin
56+
java-version: '17'
57+
cache: maven
58+
59+
- name: Run Stale Issue Auditor
60+
env:
61+
# Built-in token scoped by the `permissions:` block above. Replace with a
62+
# PAT (e.g. ${{ secrets.ADK_STALE_AGENT }}) only if you need a distinct
63+
# bot identity for the comment/label/close actions.
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
66+
GOOGLE_GENAI_USE_VERTEXAI: '0'
67+
OWNER: ${{ github.repository_owner }}
68+
REPO: ${{ github.event.repository.name }}
69+
INTERACTIVE: '0'
70+
# Defaults to a dry run (logs intended comments/labels/closures without
71+
# writing). Flip to false via manual dispatch to actually mark as stale.
72+
DRY_RUN: ${{ github.event.inputs.dry_run || 'true' }}
73+
EVENT_NAME: ${{ github.event_name }}
74+
# Max number of stale-candidate issues to audit per run.
75+
ISSUE_COUNT_TO_PROCESS: '20'
76+
# Optional: comma-separated GitHub handles to treat as maintainers when
77+
# the token cannot list push-access collaborators. Stored as a repo
78+
# variable rather than committed to source.
79+
MAINTAINERS: ${{ vars.ADK_MAINTAINERS }}
80+
run: |
81+
# Install the ADK libs + this sample, then run exec:java scoped to this
82+
# module (exec:java with -am would also run on the parent/core modules,
83+
# which have no mainClass).
84+
./mvnw -B -q -pl contrib/samples/github/adkstale -am install -DskipTests
85+
./mvnw -B -q -pl contrib/samples/github/adkstale exec:java

0 commit comments

Comments
 (0)