mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 14:36:25 +00:00
fix(github-action): do not remove paths (#10853)
This commit is contained in:
parent
73cd3d517b
commit
3a4e7428f5
2 changed files with 12 additions and 7 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue