Skip to content
Snippets Groups Projects
Unverified Commit 3a4e7428 authored by Michael Kriese's avatar Michael Kriese Committed by GitHub
Browse files

fix(github-action): do not remove paths (#10853)

parent 73cd3d51
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@
exports[`manager/github-actions/extract extractPackageFile() extracts multiple action tag lines from yaml configuration file 1`] = `
Array [
Object {
"autoReplaceStringTemplate": "{{depName}}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # renovate: tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
"autoReplaceStringTemplate": "{{depName}}/shellcheck@{{#if newDigest}}{{newDigest}}{{#if newValue}} # renovate: tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
"commitMessageTopic": "{{{depName}}} action",
"currentValue": "master",
"datasource": "github-tags",
......@@ -61,7 +61,7 @@ Array [
exports[`manager/github-actions/extract extractPackageFile() extracts multiple docker image lines from yaml configuration file 1`] = `
Array [
Object {
"autoReplaceStringTemplate": "{{depName}}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # renovate: tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
"autoReplaceStringTemplate": "{{depName}}/shellcheck@{{#if newDigest}}{{newDigest}}{{#if newValue}} # renovate: tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
"commitMessageTopic": "{{{depName}}} action",
"currentValue": "master",
"datasource": "github-tags",
......@@ -82,7 +82,7 @@ Array [
"versioning": "docker",
},
Object {
"autoReplaceStringTemplate": "{{depName}}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # renovate: tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
"autoReplaceStringTemplate": "{{depName}}/cli@{{#if newDigest}}{{newDigest}}{{#if newValue}} # renovate: tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
"commitMessageTopic": "{{{depName}}} action",
"currentValue": "master",
"datasource": "github-tags",
......
......@@ -7,7 +7,7 @@ import type { PackageDependency, PackageFile } from '../types';
const dockerRe = /^\s+uses: docker:\/\/([^"]+)\s*$/;
const actionRe =
/^\s+-?\s+?uses: (?<replaceString>(?<depName>[\w-]+\/[\w-]+)(?<path>.*)?@(?<currentValue>.+?)(?: # renovate: tag=(?<tag>.+?))?)\s*?$/;
/^\s+-?\s+?uses: (?<replaceString>(?<depName>[\w-]+\/[\w-]+)(?<path>\/.*)?@(?<currentValue>.+?)(?: # renovate: tag=(?<tag>.+?))?)\s*?$/;
// SHA1 or SHA256, see https://github.blog/2020-10-19-git-2-29-released/
const shaRe = /^[a-z0-9]{40}|[a-z0-9]{64}$/;
......@@ -32,7 +32,13 @@ export function extractPackageFile(content: string): PackageFile | null {
const tagMatch = actionRe.exec(line);
if (tagMatch?.groups) {
const { depName, currentValue, tag, replaceString } = tagMatch.groups;
const {
depName,
currentValue,
path = '',
tag,
replaceString,
} = tagMatch.groups;
const dep: PackageDependency = {
depName,
commitMessageTopic: '{{{depName}}} action',
......@@ -40,8 +46,7 @@ export function extractPackageFile(content: string): PackageFile | null {
versioning: dockerVersioning.id,
depType: 'action',
replaceString,
autoReplaceStringTemplate:
'{{depName}}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # renovate: tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}',
autoReplaceStringTemplate: `{{depName}}${path}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # renovate: tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}`,
};
if (shaRe.test(currentValue)) {
dep.currentValue = tag;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment