Files
Jamie Tanna 2b84f8c13d refactor(manager/github-actions): restructure directory for known-actions (#46248)
As noted in #46242, the `known-actions.ts` file was getting a bit big.

Where we have dynamic extractions, using `transform`, we split these
into a `<datasource>-dynamic.ts` file.

Where we have multiple packages extracted from the same Action, we use
`multiple.ts`.

Per suggestion from Sebastian, we can break this down by the datasource
used by the Action's inputs.

We can also try to enforce the structure of the directories by adding a
test in each file.

Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io>
2026-09-16 11:40:35 +00:00

30 lines
873 B
TypeScript

import { z } from 'zod/v4';
import { regEx } from '../../../../util/regex.ts';
import { GithubReleaseAttachmentsDatasource } from '../../../datasource/github-release-attachments/index.ts';
import type { ActionSchema, KnownActionConfig } from '../types.ts';
import { parseValue } from './utils.ts';
const sha256Regex = regEx(/^[a-f0-9]{64}$/);
const MiseWith: ActionSchema = z
.object({
version: z.string().optional(),
sha256: z.string().optional(),
})
.transform(({ version, sha256 }) => [
{
...parseValue(version),
...(sha256 && sha256Regex.test(sha256) ? { currentDigest: sha256 } : {}),
},
]);
export const githubReleaseAttachmentsDynamicActions: Record<
string,
KnownActionConfig
> = {
'jdx/mise-action': {
datasource: GithubReleaseAttachmentsDatasource.id,
packageName: 'jdx/mise',
withSchema: MiseWith,
},
};