Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions lib/modules/manager/github-actions/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

<!-- Autogenerate in https://github.com/renovatebot/renovate -->
54 changes: 43 additions & 11 deletions tools/docs/manager/github-actions/community.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,62 @@
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(
dist: string,
): Promise<void> {
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,
Expand Down
Loading