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
12 changes: 0 additions & 12 deletions lib/data/replacements.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"replacements:actions-attest-build-provenance-to-actions-attest",
"replacements:airbnb-prop-types-to-prop-types-tools",
"replacements:apollo-server-to-scoped",
"replacements:astral-v8-full-semver",
"replacements:babel-eslint-to-eslint-parser",
"replacements:base-ui-components-to-base-ui",
"replacements:containerbase",
Expand Down Expand Up @@ -150,17 +149,6 @@
}
]
},
"astral-v8-full-semver": {
"description": "`astral-sh/setup-astral` now requires full SemVer tags as of v8",
"packageRules": [
{
"matchPackageNames": ["astral-sh/setup-uv"],
"matchDatasources": ["github-tags"],
"replacementName": "astral-sh/setup-uv",
"replacementVersion": "v8.0.0"
}
]
},
"babel-eslint-to-eslint-parser": {
"description": "`babel-eslint` was renamed under the `@babel` scope.",
"packageRules": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ exports[`modules/manager/github-actions/extract > extractPackageFile() > extract
"depName": "docker/setup-qemu-action",
"depType": "action",
"replaceString": "docker/setup-qemu-action@c308fdd69d26ed66f4506ebd74b180abe5362145 # renovate: tag=v1.1.0",
"versioning": "semver-partial",
"versioning": "docker",
},
{
"autoReplaceStringTemplate": "{{depName}}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # {{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
Expand All @@ -31,7 +31,7 @@ exports[`modules/manager/github-actions/extract > extractPackageFile() > extract
"depName": "actions/checkout",
"depType": "action",
"replaceString": "actions/checkout@1.0.0",
"versioning": "semver-partial",
"versioning": "docker",
},
{
"autoReplaceStringTemplate": "{{depName}}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # {{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
Expand All @@ -44,7 +44,7 @@ exports[`modules/manager/github-actions/extract > extractPackageFile() > extract
"enabled": false,
"replaceString": "docker/setup-qemu-action@c308fdd69d26ed66f4506ebd74b180abe5362145",
"skipReason": "unversioned-reference",
"versioning": "semver-partial",
"versioning": "docker",
},
{
"autoReplaceStringTemplate": "{{depName}}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # {{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
Expand All @@ -54,7 +54,7 @@ exports[`modules/manager/github-actions/extract > extractPackageFile() > extract
"depName": "docker/build-push-action",
"depType": "action",
"replaceString": "docker/build-push-action@v2",
"versioning": "semver-partial",
"versioning": "docker",
},
{
"autoReplaceStringTemplate": "{{depName}}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # {{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
Expand All @@ -65,7 +65,7 @@ exports[`modules/manager/github-actions/extract > extractPackageFile() > extract
"depName": "actions/checkout",
"depType": "action",
"replaceString": "actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # tag=v2.4.0",
"versioning": "semver-partial",
"versioning": "docker",
},
{
"autoReplaceStringTemplate": "{{depName}}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # {{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
Expand All @@ -76,7 +76,7 @@ exports[`modules/manager/github-actions/extract > extractPackageFile() > extract
"depName": "actions-rs/toolchain",
"depType": "action",
"replaceString": "actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7",
"versioning": "semver-partial",
"versioning": "docker",
},
{
"autoReplaceStringTemplate": "{{depName}}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # {{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
Expand All @@ -86,7 +86,7 @@ exports[`modules/manager/github-actions/extract > extractPackageFile() > extract
"depName": "actions-rs/cargo",
"depType": "action",
"replaceString": "actions-rs/cargo@v1.0.3",
"versioning": "semver-partial",
"versioning": "docker",
},
{
"autoReplaceStringTemplate": "{{depName}}-{{newValue}}",
Expand Down
83 changes: 21 additions & 62 deletions lib/modules/manager/github-actions/extract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ describe('modules/manager/github-actions/extract', () => {
depName: 'pascalgn/automerge-action',
depType: 'action',
replaceString: '"pascalgn/automerge-action@v0.13.1"',
versioning: 'semver-partial',
versioning: 'docker',
},
{
currentValue: 'v2.3.5',
Expand All @@ -172,23 +172,23 @@ describe('modules/manager/github-actions/extract', () => {
depType: 'action',
replaceString:
'actions/checkout@1e204e9a9253d643386038d443f96446fa156a97 # renovate: tag=v2.3.5',
versioning: 'semver-partial',
versioning: 'docker',
},
{
currentValue: 'v1',
datasource: 'github-tags',
depName: 'actions/checkout',
depType: 'action',
replaceString: 'actions/checkout@v1',
versioning: 'semver-partial',
versioning: 'docker',
},
{
currentValue: 'v1.1.2',
datasource: 'github-tags',
depName: 'actions/checkout',
depType: 'action',
replaceString: '"actions/checkout@v1.1.2"',
versioning: 'semver-partial',
versioning: 'docker',
},
{
currentValue: '1.37.0-glibc',
Expand Down Expand Up @@ -236,7 +236,7 @@ describe('modules/manager/github-actions/extract', () => {
depName: 'actions/setup-node',
commitMessageTopic: '{{{depName}}} action',
datasource: 'github-tags',
versioning: 'semver-partial',
versioning: 'docker',
depType: 'action',
replaceString:
'actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # tag=v3.1.1',
Expand All @@ -249,7 +249,7 @@ describe('modules/manager/github-actions/extract', () => {
depName: 'actions/setup-node',
commitMessageTopic: '{{{depName}}} action',
datasource: 'github-tags',
versioning: 'semver-partial',
versioning: 'docker',
depType: 'action',
replaceString:
"'actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561' # tag=v3.1.1",
Expand All @@ -262,7 +262,7 @@ describe('modules/manager/github-actions/extract', () => {
depName: 'actions/setup-node',
commitMessageTopic: '{{{depName}}} action',
datasource: 'github-tags',
versioning: 'semver-partial',
versioning: 'docker',
depType: 'action',
replaceString:
'"actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561" # tag=v2.5.1',
Expand All @@ -275,7 +275,7 @@ describe('modules/manager/github-actions/extract', () => {
depName: 'actions/checkout',
commitMessageTopic: '{{{depName}}} action',
datasource: 'github-tags',
versioning: 'semver-partial',
versioning: 'docker',
depType: 'action',
replaceString: '"actions/checkout@v2"',
autoReplaceStringTemplate:
Expand All @@ -286,7 +286,7 @@ describe('modules/manager/github-actions/extract', () => {
depName: 'actions/setup-java',
commitMessageTopic: '{{{depName}}} action',
datasource: 'github-tags',
versioning: 'semver-partial',
versioning: 'docker',
depType: 'action',
replaceString: '"actions/setup-java@v2"',
autoReplaceStringTemplate:
Expand Down Expand Up @@ -575,7 +575,7 @@ describe('modules/manager/github-actions/extract', () => {
expect(res?.deps[0]).toEqual({
depName: 'actions/checkout',
commitMessageTopic: '{{{depName}}} action',
versioning: 'semver-partial',
versioning: 'docker',
depType: 'action',
replaceString:
'actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v4',
Expand All @@ -600,7 +600,7 @@ describe('modules/manager/github-actions/extract', () => {
expect(res?.deps[0]).toEqual({
depName: 'actions/checkout',
commitMessageTopic: '{{{depName}}} action',
versioning: 'semver-partial',
versioning: 'docker',
depType: 'action',
replaceString: 'actions/checkout@c85c95e # v4',
autoReplaceStringTemplate:
Expand Down Expand Up @@ -776,7 +776,7 @@ describe('modules/manager/github-actions/extract', () => {
depName: 'actions/setup-node',
depType: 'action',
replaceString: 'actions/setup-node@v3',
versioning: 'semver-partial',
versioning: 'docker',
},
{
autoReplaceStringTemplate:
Expand All @@ -787,7 +787,7 @@ describe('modules/manager/github-actions/extract', () => {
depName: 'actions/setup-node',
depType: 'action',
replaceString: 'actions/setup-node@v3',
versioning: 'semver-partial',
versioning: 'docker',
},
{
autoReplaceStringTemplate:
Expand All @@ -798,7 +798,7 @@ describe('modules/manager/github-actions/extract', () => {
depName: 'actions/setup-go',
depType: 'action',
replaceString: 'actions/setup-go@v5',
versioning: 'semver-partial',
versioning: 'docker',
},
{
autoReplaceStringTemplate:
Expand All @@ -809,7 +809,7 @@ describe('modules/manager/github-actions/extract', () => {
depName: 'actions/setup-python',
depType: 'action',
replaceString: 'actions/setup-python@v3',
versioning: 'semver-partial',
versioning: 'docker',
},
{
autoReplaceStringTemplate:
Expand All @@ -820,7 +820,7 @@ describe('modules/manager/github-actions/extract', () => {
depName: 'actions/setup-node',
depType: 'action',
replaceString: 'actions/setup-node@v3',
versioning: 'semver-partial',
versioning: 'docker',
},
{
depName: 'node',
Expand Down Expand Up @@ -926,7 +926,7 @@ describe('modules/manager/github-actions/extract', () => {
depName: 'actions/setup-node',
depType: 'action',
replaceString: 'actions/setup-node@v3',
versioning: 'semver-partial',
versioning: 'docker',
},
{
autoReplaceStringTemplate:
Expand All @@ -937,7 +937,7 @@ describe('modules/manager/github-actions/extract', () => {
depName: 'actions/setup-node',
depType: 'action',
replaceString: 'actions/setup-node@v3',
versioning: 'semver-partial',
versioning: 'docker',
},
{
autoReplaceStringTemplate:
Expand All @@ -948,7 +948,7 @@ describe('modules/manager/github-actions/extract', () => {
depName: 'actions/setup-go',
depType: 'action',
replaceString: 'actions/setup-go@v5',
versioning: 'semver-partial',
versioning: 'docker',
},
{
autoReplaceStringTemplate:
Expand All @@ -959,7 +959,7 @@ describe('modules/manager/github-actions/extract', () => {
depName: 'actions/setup-python',
depType: 'action',
replaceString: 'actions/setup-python@v3',
versioning: 'semver-partial',
versioning: 'docker',
},
{
autoReplaceStringTemplate:
Expand All @@ -970,7 +970,7 @@ describe('modules/manager/github-actions/extract', () => {
depName: 'actions/setup-node',
depType: 'action',
replaceString: 'actions/setup-node@v3',
versioning: 'semver-partial',
versioning: 'docker',
},
{
depName: 'node',
Expand Down Expand Up @@ -1469,45 +1469,4 @@ describe('modules/manager/github-actions/extract', () => {
expected,
);
});

it.each([
{
step: {
uses: 'astral-sh/setup-uv@v7',
},
expected: {
currentValue: 'v7',
datasource: 'github-tags',
depName: 'astral-sh/setup-uv',
depType: 'action',
},
},
{
step: {
uses: 'astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57',
},
expected: {
currentDigest: 'cec208311dfd045dd5311c1add060b2062131d57',
datasource: 'github-tags',
depName: 'astral-sh/setup-uv',
depType: 'action',
},
},
])(
'overrides versioning for actions with Immutable tags: $step.uses',
({ step, expected }) => {
const yamlContent = yaml.dump({ jobs: { build: { steps: [step] } } });

const res = extractPackageFile(yamlContent, 'workflow.yml');
expect(res?.deps.filter((pkg) => pkg.depType === 'action')).toMatchObject(
[
{
versioning:
'regex:^v?(?<major>\\d+)(\\.(?<minor>\\d+)\\.(?<patch>\\d+))?$',
...expected,
},
],
);
},
);
});
15 changes: 1 addition & 14 deletions lib/modules/manager/github-actions/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,18 @@ import * as dockerVersioning from '../../versioning/docker/index.ts';
import * as exactVersioning from '../../versioning/exact/index.ts';
import * as nodeVersioning from '../../versioning/node/index.ts';
import * as npmVersioning from '../../versioning/npm/index.ts';
import * as semverPartialVersioning from '../../versioning/semver-partial/index.ts';
import { getDep } from '../dockerfile/extract.ts';
import type {
ExtractConfig,
PackageDependency,
PackageFileContent,
} from '../types.ts';
import { CommunityActions } from './community.ts';
import { ActionsUsingGitHubImmutableTags } from './immutable-actions.ts';
import type { DockerReference, RepositoryReference } from './parse.ts';
import { isSha, isShortSha, parseUsesLine, versionLikeRe } from './parse.ts';
import type { Steps } from './schema.ts';
import { Workflow } from './schema.ts';

const semverWithOptionalMinorAndPatchversioning =
'regex:^v?(?<major>\\d+)(\\.(?<minor>\\d+)\\.(?<patch>\\d+))?$';

// detects if we run against a Github Enterprise Server and adds the URL to the beginning of the registryURLs for looking up Actions
// This reflects the behavior of how GitHub looks up Actions
// First on the Enterprise Server, then on GitHub.com
Expand Down Expand Up @@ -91,7 +86,7 @@ function extractRepositoryAction(
const dep: PackageDependency = {
depName,
commitMessageTopic: '{{{depName}}} action',
versioning: semverPartialVersioning.id,
versioning: dockerVersioning.id,
depType: 'action',
replaceString: valueString,
autoReplaceStringTemplate: `${quote}{{depName}}${pathSuffix}@{{#if newDigest}}{{newDigest}}${quote}{{#if newValue}}${commentWs}# {{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}${quote}{{/unless}}`,
Expand Down Expand Up @@ -371,13 +366,5 @@ export function extractPackageFile(
return null;
}

for (const dep of deps) {
if (
ActionsUsingGitHubImmutableTags.includes(dep.packageName ?? dep.depName!)
) {
dep.versioning = semverWithOptionalMinorAndPatchversioning;
}
}

return { deps };
}
7 changes: 0 additions & 7 deletions lib/modules/manager/github-actions/immutable-actions.ts

This file was deleted.

Loading