diff --git a/lib/modules/manager/github-actions/readme.md b/lib/modules/manager/github-actions/readme.md index b738bfaca73..76f82525ca2 100644 --- a/lib/modules/manager/github-actions/readme.md +++ b/lib/modules/manager/github-actions/readme.md @@ -102,8 +102,24 @@ For example, normally the `^` syntax is not used in `go` or `python`, but it's s Depending on your use case, you may need to change `versioning` manually. If you find a use case which you think Renovate could/should automatically detect and support without manual configuration, please raise a Discussion to suggest it. -### commonly used community actions +### Updating `with:` values in commonly used Community-maintained GitHub Actions -Renovate also supports some commonly used community actions: +Third-party GitHub Actions will commonly specify a version of a given tool using a `with:` block, such as: + +GitHub Actions maintained by the wider community have `with:` blocks such as: + +```yaml +steps: +- uses: astral-sh/setup-uv@v8.1.0 + with: + version: '0.4.x' + +- uses: 'denoland/setup-deno@v2', + with: + deno-version: '2.4.0' +``` + +Renovate supports extracting some of these input(s) from the following Actions, and performing automagic dependency updates accordingly. +The following third-party Actions have support for their `with:` blocks: diff --git a/tools/docs/manager/github-actions/community.ts b/tools/docs/manager/github-actions/community.ts index b83fb1c06e8..cb3332c9912 100644 --- a/tools/docs/manager/github-actions/community.ts +++ b/tools/docs/manager/github-actions/community.ts @@ -1,22 +1,54 @@ +import { codeBlock } from 'common-tags'; +import { z } from 'zod/v4'; import type { CommunityActionConfig } from '../../../../lib/modules/manager/github-actions/community.ts'; import { communityActions } from '../../../../lib/modules/manager/github-actions/community.ts'; import { readFile, updateFile } from '../../../utils/index.ts'; import { replaceContent } from '../../utils.ts'; -function generateTool({ depName, packageName }: CommunityActionConfig): string { +function getWithSchemaFields( + schema: CommunityActionConfig['withSchema'], +): string[] { + if (!schema) { + return ['version']; + } + // `z.object({...}).transform(...)` produces a ZodPipe in Zod v4, where + // `def.in` is the source ZodObject. Walk through any pipes until we hit it. + let current: z.ZodType = schema; + while ('in' in current.def) { + current = current.def.in as z.ZodType; + } + if (current instanceof z.ZodObject) { + return Object.keys(current.shape); + } + return ['version']; +} + +function determineDependencyToUpdate({ + depName, + packageName, +}: CommunityActionConfig): string { if (!depName && !packageName) { - return ''; + // some actions determine the depName and packageName dynamically + return '(determined from `with` input(s))'; } - return ` ([\`${depName ?? packageName}\`](https://github.com/${packageName}))`; + + return `[\`${depName ?? packageName}\`](https://github.com/${packageName})`; } -function generateTooling(): string { - return Object.entries(communityActions) - .map( - ([name, cfg]) => - `- [\`${name}\`](https://github.com/${name})${generateTool(cfg)}`, - ) - .join('\n'); +function generateToolingTable(): string { + let table = codeBlock` + | Action | \`with\` input(s) used | Dependency | + | --- | --- | --- | + `; + table += '\n'; + + for (const [name, cfg] of Object.entries(communityActions)) { + const withFields = getWithSchemaFields(cfg.withSchema); + + table += `| [\`${name}\`](https://github.com/${name}) | \`${withFields.join('`, `')}\` | ${determineDependencyToUpdate(cfg)} |\n`; + } + + return table; } export async function generateManagerGithubActionsCommunity( @@ -24,7 +56,7 @@ export async function generateManagerGithubActionsCommunity( ): Promise { const indexFileName = `${dist}/modules/manager/github-actions/index.md`; let indexContent = await readFile(indexFileName); - indexContent = replaceContent(indexContent, generateTooling()); + indexContent = replaceContent(indexContent, generateToolingTable()); await updateFile( `${dist}/modules/manager/github-actions/index.md`, indexContent,