mirror of
https://github.com/googleapis/genai-toolbox.git
synced 2026-04-09 03:02:26 -04:00
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/github-script](https://redirect.github.com/actions/github-script) | action | major | `v7.1.0` -> `v8.0.0` | | [actions/github-script](https://redirect.github.com/actions/github-script) | action | major | `v7` -> `v8` | | [actions/setup-go](https://redirect.github.com/actions/setup-go) | action | major | `v5.5.0` -> `v6.0.0` | | [actions/setup-node](https://redirect.github.com/actions/setup-node) | action | major | `v4` -> `v5` | --- ### Release Notes <details> <summary>actions/github-script (actions/github-script)</summary> ### [`v8.0.0`](https://redirect.github.com/actions/github-script/compare/v7.1.0...v8.0.0) [Compare Source](https://redirect.github.com/actions/github-script/compare/v7.1.0...v8.0.0) </details> <details> <summary>actions/setup-go (actions/setup-go)</summary> ### [`v6.0.0`](https://redirect.github.com/actions/setup-go/releases/tag/v6.0.0) [Compare Source](https://redirect.github.com/actions/setup-go/compare/v5.5.0...v6.0.0) #### What's Changed ##### Breaking Changes - Improve toolchain handling to ensure more reliable and consistent toolchain selection and management by [@​matthewhughes934](https://redirect.github.com/matthewhughes934) in [#​460](https://redirect.github.com/actions/setup-go/pull/460) - Upgrade Nodejs runtime from node20 to node 24 by [@​salmanmkc](https://redirect.github.com/salmanmkc) in [#​624](https://redirect.github.com/actions/setup-go/pull/624) Make sure your runner is on version v2.327.1 or later to ensure compatibility with this release. [See Release Notes](https://redirect.github.com/actions/runner/releases/tag/v2.327.1) ##### Dependency Upgrades - Upgrade [@​types/jest](https://redirect.github.com/types/jest) from 29.5.12 to 29.5.14 by [@​dependabot](https://redirect.github.com/dependabot)\[bot] in [#​589](https://redirect.github.com/actions/setup-go/pull/589) - Upgrade [@​actions/tool-cache](https://redirect.github.com/actions/tool-cache) from 2.0.1 to 2.0.2 by [@​dependabot](https://redirect.github.com/dependabot)\[bot] in [#​591](https://redirect.github.com/actions/setup-go/pull/591) - Upgrade [@​typescript-eslint/parser](https://redirect.github.com/typescript-eslint/parser) from 8.31.1 to 8.35.1 by [@​dependabot](https://redirect.github.com/dependabot)\[bot] in [#​590](https://redirect.github.com/actions/setup-go/pull/590) - Upgrade undici from 5.28.5 to 5.29.0 by [@​dependabot](https://redirect.github.com/dependabot)\[bot] in [#​594](https://redirect.github.com/actions/setup-go/pull/594) - Upgrade typescript from 5.4.2 to 5.8.3 by [@​dependabot](https://redirect.github.com/dependabot)\[bot] in [#​538](https://redirect.github.com/actions/setup-go/pull/538) - Upgrade eslint-plugin-jest from 28.11.0 to 29.0.1 by [@​dependabot](https://redirect.github.com/dependabot)\[bot] in [#​603](https://redirect.github.com/actions/setup-go/pull/603) - Upgrade `form-data` to bring in fix for critical vulnerability by [@​matthewhughes934](https://redirect.github.com/matthewhughes934) in [#​618](https://redirect.github.com/actions/setup-go/pull/618) - Upgrade actions/checkout from 4 to 5 by [@​dependabot](https://redirect.github.com/dependabot)\[bot] in [#​631](https://redirect.github.com/actions/setup-go/pull/631) #### New Contributors - [@​matthewhughes934](https://redirect.github.com/matthewhughes934) made their first contribution in [#​618](https://redirect.github.com/actions/setup-go/pull/618) - [@​salmanmkc](https://redirect.github.com/salmanmkc) made their first contribution in [#​624](https://redirect.github.com/actions/setup-go/pull/624) **Full Changelog**: <https://github.com/actions/setup-go/compare/v5...v6.0.0> </details> <details> <summary>actions/setup-node (actions/setup-node)</summary> ### [`v5`](https://redirect.github.com/actions/setup-node/compare/v4...v5) [Compare Source](https://redirect.github.com/actions/setup-node/compare/v4...v5) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/googleapis/genai-toolbox). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS45MS4xIiwidXBkYXRlZEluVmVyIjoiNDEuOTEuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: Averi Kitsch <akitsch@google.com>
180 lines
7.7 KiB
YAML
180 lines
7.7 KiB
YAML
# Copyright 2025 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: Cloud Build Failure Reporter
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
trigger_names:
|
|
required: true
|
|
type: string
|
|
workflow_dispatch:
|
|
inputs:
|
|
trigger_names:
|
|
description: 'Cloud Build trigger names separated by comma.'
|
|
required: true
|
|
default: ''
|
|
|
|
jobs:
|
|
report:
|
|
|
|
permissions:
|
|
issues: 'write'
|
|
checks: 'read'
|
|
|
|
runs-on: 'ubuntu-latest'
|
|
|
|
steps:
|
|
- uses: 'actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd' # v8
|
|
with:
|
|
script: |-
|
|
// parse test names
|
|
const testNameSubstring = '${{ inputs.trigger_names }}';
|
|
const testNameFound = new Map(); //keeps track of whether each test is found
|
|
testNameSubstring.split(',').forEach(testName => {
|
|
testNameFound.set(testName, false);
|
|
});
|
|
|
|
// label for all issues opened by reporter
|
|
const periodicLabel = 'periodic-failure';
|
|
|
|
// check if any reporter opened any issues previously
|
|
const prevIssues = await github.paginate(github.rest.issues.listForRepo, {
|
|
...context.repo,
|
|
state: 'open',
|
|
creator: 'github-actions[bot]',
|
|
labels: [periodicLabel]
|
|
});
|
|
|
|
// createOrCommentIssue creates a new issue or comments on an existing issue.
|
|
const createOrCommentIssue = async function (title, txt) {
|
|
if (prevIssues.length < 1) {
|
|
console.log('no previous issues found, creating one');
|
|
await github.rest.issues.create({
|
|
...context.repo,
|
|
title: title,
|
|
body: txt,
|
|
labels: [periodicLabel]
|
|
});
|
|
return;
|
|
}
|
|
// only comment on issue related to the current test
|
|
for (const prevIssue of prevIssues) {
|
|
if (prevIssue.title.includes(title)){
|
|
console.log(
|
|
`found previous issue ${prevIssue.html_url}, adding comment`
|
|
);
|
|
|
|
await github.rest.issues.createComment({
|
|
...context.repo,
|
|
issue_number: prevIssue.number,
|
|
body: txt
|
|
});
|
|
return;
|
|
}
|
|
}
|
|
};
|
|
|
|
// updateIssues comments on any existing issues. No-op if no issue exists.
|
|
const updateIssues = async function (checkName, txt) {
|
|
if (prevIssues.length < 1) {
|
|
console.log('no previous issues found.');
|
|
return;
|
|
}
|
|
// only comment on issue related to the current test
|
|
for (const prevIssue of prevIssues) {
|
|
if (prevIssue.title.includes(checkName)){
|
|
console.log(`found previous issue ${prevIssue.html_url}, adding comment`);
|
|
await github.rest.issues.createComment({
|
|
...context.repo,
|
|
issue_number: prevIssue.number,
|
|
body: txt
|
|
});
|
|
}
|
|
}
|
|
};
|
|
|
|
// Find status of check runs.
|
|
// We will find check runs for each commit and then filter for the periodic.
|
|
// Checks API only allows for ref and if we use main there could be edge cases where
|
|
// the check run happened on a SHA that is different from head.
|
|
const commits = await github.paginate(github.rest.repos.listCommits, {
|
|
...context.repo
|
|
});
|
|
|
|
const relevantChecks = new Map();
|
|
for (const commit of commits) {
|
|
console.log(
|
|
`checking runs at ${commit.html_url}: ${commit.commit.message}`
|
|
);
|
|
const checks = await github.rest.checks.listForRef({
|
|
...context.repo,
|
|
ref: commit.sha
|
|
});
|
|
|
|
// Iterate through each check and find matching names
|
|
for (const check of checks.data.check_runs) {
|
|
console.log(`Handling test name ${check.name}`);
|
|
for (const testName of testNameFound.keys()) {
|
|
if (testNameFound.get(testName) === true){
|
|
//skip if a check is already found for this name
|
|
continue;
|
|
}
|
|
if (check.name.includes(testName)) {
|
|
relevantChecks.set(check, commit);
|
|
testNameFound.set(testName, true);
|
|
}
|
|
}
|
|
}
|
|
// Break out of the loop early if all tests are found
|
|
const allTestsFound = Array.from(testNameFound.values()).every(value => value === true);
|
|
if (allTestsFound){
|
|
break;
|
|
}
|
|
}
|
|
|
|
// Handle each relevant check
|
|
relevantChecks.forEach((commit, check) => {
|
|
if (
|
|
check.status === 'completed' &&
|
|
check.conclusion === 'success'
|
|
) {
|
|
updateIssues(
|
|
check.name,
|
|
`[Tests are passing](${check.html_url}) for commit [${commit.sha}](${commit.html_url}).`
|
|
);
|
|
} else if (check.status === 'in_progress') {
|
|
console.log(
|
|
`Check is pending ${check.html_url} for ${commit.html_url}. Retry again later.`
|
|
);
|
|
} else {
|
|
createOrCommentIssue(
|
|
`Cloud Build Failure Reporter: ${check.name} failed`,
|
|
`Cloud Build Failure Reporter found test failure for [**${check.name}** ](${check.html_url}) at [${commit.sha}](${commit.html_url}). Please fix the error and then close the issue after the **${check.name}** test passes.`
|
|
);
|
|
}
|
|
});
|
|
|
|
// no periodic checks found across all commits, report it
|
|
const noTestFound = Array.from(testNameFound.values()).every(value => value === false);
|
|
if (noTestFound){
|
|
createOrCommentIssue(
|
|
'Missing periodic tests: ${{ inputs.trigger_names }}',
|
|
`No periodic test is found for triggers: ${{ inputs.trigger_names }}. Last checked from ${
|
|
commits[0].html_url
|
|
} to ${commits[commits.length - 1].html_url}.`
|
|
);
|
|
}
|