Skip to content

Commit

Permalink
feat(github-actions): Change behavior to not add "renovate" to inline…
Browse files Browse the repository at this point in the history
… yaml comments when pinning (#14110)
  • Loading branch information
soenkeliebau authored Feb 9, 2022
1 parent 27afe43 commit 5d419a1
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 10 deletions.
15 changes: 15 additions & 0 deletions lib/manager/github-actions/__fixtures__/workflow_2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,18 @@ jobs:
- uses: docker/setup-qemu-action@c308fdd69d26ed66f4506ebd74b180abe5362145
- name: Build
uses: docker/build-push-action@v2
rustfmt:
name: Run Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # tag=v2.4.0
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7
with:
profile: minimal
toolchain: stable
components: rustfmt
override: true
- uses: actions-rs/[email protected]
with:
command: fmt
args: --all -- --check
46 changes: 39 additions & 7 deletions lib/manager/github-actions/__snapshots__/extract.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`manager/github-actions/extract extractPackageFile() extracts multiple action tag lines from yaml configuration file 1`] = `
Array [
Object {
"autoReplaceStringTemplate": "{{depName}}/shellcheck@{{#if newDigest}}{{newDigest}}{{#if newValue}} # renovate: tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
"autoReplaceStringTemplate": "{{depName}}/shellcheck@{{#if newDigest}}{{newDigest}}{{#if newValue}} # tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
"commitMessageTopic": "{{{depName}}} action",
"currentValue": "master",
"datasource": "github-tags",
Expand All @@ -14,7 +14,7 @@ Array [
"versioning": "docker",
},
Object {
"autoReplaceStringTemplate": "{{depName}}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # renovate: tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
"autoReplaceStringTemplate": "{{depName}}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
"commitMessageTopic": "{{{depName}}} action",
"currentDigest": "c308fdd69d26ed66f4506ebd74b180abe5362145",
"currentValue": "v1.1.0",
Expand All @@ -25,7 +25,7 @@ Array [
"versioning": "docker",
},
Object {
"autoReplaceStringTemplate": "{{depName}}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # renovate: tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
"autoReplaceStringTemplate": "{{depName}}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
"commitMessageTopic": "{{{depName}}} action",
"currentValue": "1.0.0",
"datasource": "github-tags",
Expand All @@ -35,7 +35,7 @@ Array [
"versioning": "docker",
},
Object {
"autoReplaceStringTemplate": "{{depName}}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # renovate: tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
"autoReplaceStringTemplate": "{{depName}}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
"commitMessageTopic": "{{{depName}}} action",
"currentDigest": "c308fdd69d26ed66f4506ebd74b180abe5362145",
"currentValue": undefined,
Expand All @@ -46,7 +46,7 @@ Array [
"versioning": "docker",
},
Object {
"autoReplaceStringTemplate": "{{depName}}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # renovate: tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
"autoReplaceStringTemplate": "{{depName}}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
"commitMessageTopic": "{{{depName}}} action",
"currentValue": "v2",
"datasource": "github-tags",
Expand All @@ -55,13 +55,45 @@ Array [
"replaceString": "docker/build-push-action@v2",
"versioning": "docker",
},
Object {
"autoReplaceStringTemplate": "{{depName}}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
"commitMessageTopic": "{{{depName}}} action",
"currentDigest": "ec3a7ce113134d7a93b817d10a8272cb61118579",
"currentValue": "v2.4.0",
"datasource": "github-tags",
"depName": "actions/checkout",
"depType": "action",
"replaceString": "actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # tag=v2.4.0",
"versioning": "docker",
},
Object {
"autoReplaceStringTemplate": "{{depName}}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
"commitMessageTopic": "{{{depName}}} action",
"currentDigest": "16499b5e05bf2e26879000db0c1d13f7e13fa3af",
"currentValue": "v1.0.7",
"datasource": "github-tags",
"depName": "actions-rs/toolchain",
"depType": "action",
"replaceString": "actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7",
"versioning": "docker",
},
Object {
"autoReplaceStringTemplate": "{{depName}}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
"commitMessageTopic": "{{{depName}}} action",
"currentValue": "v1.0.3",
"datasource": "github-tags",
"depName": "actions-rs/cargo",
"depType": "action",
"replaceString": "actions-rs/[email protected]",
"versioning": "docker",
},
]
`;

exports[`manager/github-actions/extract extractPackageFile() extracts multiple docker image lines from yaml configuration file 1`] = `
Array [
Object {
"autoReplaceStringTemplate": "{{depName}}/shellcheck@{{#if newDigest}}{{newDigest}}{{#if newValue}} # renovate: tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
"autoReplaceStringTemplate": "{{depName}}/shellcheck@{{#if newDigest}}{{newDigest}}{{#if newValue}} # tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
"commitMessageTopic": "{{{depName}}} action",
"currentValue": "master",
"datasource": "github-tags",
Expand All @@ -82,7 +114,7 @@ Array [
"versioning": "docker",
},
Object {
"autoReplaceStringTemplate": "{{depName}}/cli@{{#if newDigest}}{{newDigest}}{{#if newValue}} # renovate: tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
"autoReplaceStringTemplate": "{{depName}}/cli@{{#if newDigest}}{{newDigest}}{{#if newValue}} # tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}",
"commitMessageTopic": "{{{depName}}} action",
"currentValue": "master",
"datasource": "github-tags",
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/github-actions/extract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('manager/github-actions/extract', () => {
expect(res.deps).toMatchSnapshot();
expect(
res.deps.filter((d) => d.datasource === 'github-tags')
).toHaveLength(5);
).toHaveLength(8);
});
});
});
4 changes: 2 additions & 2 deletions lib/manager/github-actions/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { PackageDependency, PackageFile } from '../types';

const dockerRe = regEx(/^\s+uses: docker:\/\/([^"]+)\s*$/);
const actionRe = regEx(
/^\s+-?\s+?uses: (?<replaceString>(?<depName>[\w-]+\/[\w-]+)(?<path>\/.*)?@(?<currentValue>.+?)(?: # renovate: tag=(?<tag>.+?))?)\s*?$/
/^\s+-?\s+?uses: (?<replaceString>(?<depName>[\w-]+\/[\w-]+)(?<path>\/.*)?@(?<currentValue>.+?)\s*(?:#\s+(?:renovate:\s+)?tag=(?<tag>.+?))?)\s*?$/
);

// SHA1 or SHA256, see https://github.blog/2020-10-19-git-2-29-released/
Expand Down Expand Up @@ -47,7 +47,7 @@ export function extractPackageFile(content: string): PackageFile | null {
versioning: dockerVersioning.id,
depType: 'action',
replaceString,
autoReplaceStringTemplate: `{{depName}}${path}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # renovate: tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}`,
autoReplaceStringTemplate: `{{depName}}${path}@{{#if newDigest}}{{newDigest}}{{#if newValue}} # tag={{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}{{/unless}}`,
};
if (shaRe.test(currentValue)) {
dep.currentValue = tag;
Expand Down

0 comments on commit 5d419a1

Please sign in to comment.