Skip to content

Commit 82c100a

Browse files
authored
Merge branch 'main' into release-please--branches--main--components--cloud-sql-sqlserver
2 parents 19f01f4 + 4d15d3a commit 82c100a

File tree

5 files changed

+238
-1
lines changed

5 files changed

+238
-1
lines changed

.github/renovate.json5

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
],
2121
pinDigests: true,
2222
},
23+
{
24+
matchPackageNames: ['googleapis/genai-toolbox'],
25+
'semanticCommitType': 'feat'
26+
}
2327
],
2428
customManagers: [
2529
{
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Issue assignment
16+
17+
on:
18+
issues:
19+
types: [opened]
20+
21+
jobs:
22+
auto-assign:
23+
runs-on: ubuntu-latest
24+
permissions:
25+
issues: write
26+
steps:
27+
- name: "Auto-assign issue"
28+
uses: pozil/auto-assign-issue@v2
29+
with:
30+
assignees: ajupazhamayil,dolphin1999,rachelhmyang,Myst9
31+
numOfAssignee: 1
32+
abortIfPreviousAssignees: true

.github/workflows/assign-prs.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: PR assignment
16+
17+
on:
18+
pull_request:
19+
types: [opened, edited, synchronize, reopened]
20+
21+
jobs:
22+
auto-assign:
23+
runs-on: ubuntu-latest
24+
permissions:
25+
pull-requests: write
26+
steps:
27+
- name: "Auto-assign PR"
28+
uses: pozil/auto-assign-issue@v2
29+
with:
30+
assignees: ajupazhamayil,dolphin1999,rachelhmyang,Myst9
31+
numOfAssignee: 1
32+
abortIfPreviousAssignees: true
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Mirror Toolbox Changelog
16+
17+
on:
18+
pull_request_target:
19+
types: [opened, edited]
20+
21+
jobs:
22+
add-release-notes:
23+
if: github.actor == 'renovate[bot]' && startsWith(github.head_ref, 'renovate/googleapis-genai-toolbox')
24+
runs-on: ubuntu-latest
25+
permissions:
26+
pull-requests: write
27+
28+
steps:
29+
- name: Add Toolbox Release Notes to PR Body
30+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
31+
env:
32+
REQUIRED_KEYWORDS: 'mssql'
33+
with:
34+
script: |
35+
const requiredKeywordsEnv = process.env.REQUIRED_KEYWORDS;
36+
const requiredKeywords = requiredKeywordsEnv.split(',').map(kw => kw.trim()).filter(kw => kw.length > 0);
37+
38+
const prBody = context.payload.pull_request.body || '';
39+
40+
// Extract the relevant changelog section
41+
const startMarker = '<summary>googleapis/genai-toolbox';
42+
const endMarker = '</details>';
43+
const startIndex = prBody.indexOf(startMarker);
44+
const endIndex = prBody.indexOf(endMarker, startIndex);
45+
46+
if (startIndex === -1 || endIndex === -1) {
47+
console.log('Could not find the release notes section in the PR body. Exiting.');
48+
return;
49+
}
50+
const releaseNotesSection = prBody.substring(startIndex, endIndex);
51+
52+
// Parse, Filter, and transform
53+
const prefixesToFilter = ['source/', 'sources/', 'tool/', 'tools/'];
54+
55+
// Use a map for cleaner type switching
56+
const typeMap = {
57+
'##### ⚠ BREAKING CHANGES': 'feat!',
58+
'##### Features': 'feat',
59+
'##### Bug Fixes': 'fix',
60+
'##### Chores': 'ignore',
61+
'##### Miscellaneous Chores': 'ignore',
62+
'##### Documentation': 'ignore',
63+
};
64+
65+
let currentType = 'feat'; // Default
66+
const newChangelog = [];
67+
68+
for (const line of releaseNotesSection.split('\n')) {
69+
const trimmedLine = line.trim();
70+
71+
// Update current type if it's a header
72+
if (typeMap[trimmedLine]) {
73+
currentType = typeMap[trimmedLine];
74+
continue;
75+
}
76+
77+
// Skip ignored sections
78+
if (currentType === 'ignore') {
79+
continue;
80+
}
81+
82+
// Match and extract changelog item
83+
const itemMatch = trimmedLine.match(/^[*-]\s(.*)$/);
84+
if (itemMatch) {
85+
const originalContent = itemMatch[1];
86+
const lineAsLowerCase = originalContent.toLowerCase();
87+
88+
const hasPrefix = prefixesToFilter.some(prefix => lineAsLowerCase.includes(prefix));
89+
90+
// Check if the line includes ANY of the required keywords
91+
let hasAnyRequiredKeyword = false;
92+
if (requiredKeywords.length > 0) {
93+
hasAnyRequiredKeyword = requiredKeywords.some(keyword => lineAsLowerCase.includes(keyword));
94+
}
95+
96+
// Include if it doesn't have a prefix OR it has any of the required keywords
97+
if (!hasPrefix || hasAnyRequiredKeyword) {
98+
newChangelog.push(`- ${currentType}: ${originalContent}`);
99+
} else {
100+
console.log(`Filtering out: ${originalContent}`);
101+
}
102+
}
103+
}
104+
105+
if (newChangelog.length === 0) {
106+
console.log('Found no changelog items to add after filtering. Exiting.');
107+
return;
108+
}
109+
110+
// Construct the override block
111+
const overrideBlock = [
112+
'\n\nBEGIN_COMMIT_OVERRIDE',
113+
...newChangelog,
114+
'END_COMMIT_OVERRIDE'
115+
].join('\n');
116+
117+
// Update PR body
118+
const baseBody = prBody.split('\n\nBEGIN_COMMIT_OVERRIDE')[0].trim();
119+
const finalBody = baseBody + overrideBlock;
120+
121+
if (finalBody === prBody) {
122+
console.log('The generated changelog is identical. No update needed.');
123+
return;
124+
}
125+
126+
// Update the PR
127+
await github.rest.pulls.update({
128+
owner: context.repo.owner,
129+
repo: context.repo.repo,
130+
pull_number: context.issue.number,
131+
body: finalBody,
132+
});
133+
134+
console.log('Successfully updated the PR body with filtered release notes.');

DEVELOPER.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,41 @@ The primary maintainers for this repository are defined in the
9797
9898
### Releasing
9999
100-
The release process is automated using `release-please`.
100+
The release process is automated using `release-please`. It consists of an automated changelog preparation step followed by the manual merging of a Release PR.
101+
102+
#### Automated Changelog Enrichment
103+
104+
Before a Release PR is even created, a special workflow automatically mirrors
105+
relevant changelogs from the core `googleapis/genai-toolbox` dependency. This
106+
ensures that the release notes for this extension accurately reflect important
107+
upstream changes.
108+
109+
The process is handled by the [`mirror-changelog.yml`](.github/workflows/mirror-changelog.yml) workflow:
110+
111+
1. **Trigger:** The workflow runs automatically on pull requests created by
112+
Renovate for `toolbox` version updates.
113+
2. **Parsing:** It reads the detailed release notes that Renovate includes in
114+
the PR body.
115+
3. **Filtering:** These release notes are filtered to include only changes
116+
relevant to this extension. The relevance is determined by a keyword (e.g.,
117+
`mssql`), passed as an environment variable in the workflow file.
118+
4. **Changelog Injection:** The script formats the filtered entries as
119+
conventional commits and injects them into the PR body within a
120+
`BEGIN_COMMIT_OVERRIDE` block.
121+
5. **Release Please:** When the main Release PR is created, `release-please`
122+
reads this override block instead of the standard `chore(deps): ...` commit
123+
message, effectively mirroring the filtered upstream changelog into this
124+
project's release notes.
125+
126+
> **Note for Maintainers:** The filtering script is an automation aid, but it
127+
> may occasionally produce "false positives" (e.g., an internal logging change
128+
> that happens to contain the keyword). Before merging a `toolbox` dependency
129+
> PR, maintainers must **review the generated `BEGIN_COMMIT_OVERRIDE` block**
130+
> and manually delete any lines that are not relevant to the end-users of this
131+
> extension. The curated override block is the final source of truth for the
132+
> release changelog.
133+
134+
#### Release Process
101135

102136
1. **Release PR:** When commits with conventional commit headers (e.g., `feat:`,
103137
`fix:`) are merged into the `main` branch, `release-please` will
@@ -109,3 +143,4 @@ The release process is automated using `release-please`.
109143
`package-and-upload-assets.yml` workflow. This workflow builds the
110144
platform-specific extension archives and uploads them as assets to the
111145
GitHub Release.
146+

0 commit comments

Comments
 (0)