Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(github-actions): add support for version tag prefixes #27882

Merged
merged 8 commits into from Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -19,3 +19,4 @@ jobs:
- uses: actions/checkout@689fcce700ae7ffc576f2b029b51b2ffb66d3abd # v2.1.0 additional comment
- uses: actions/checkout@689fcce700ae7ffc576f2b029b51b2ffb66d3abd # ratchet:actions/checkout@v2.1.0
- uses: actions/checkout@689fcce700ae7ffc576f2b029b51b2ffb66d3abd # ratchet:exclude
- uses: actions-runner-controller/execute-assert-arc-e2e@f1d7c52253b89f0beae60141f8465d9495cdc2cf # actions-runner-controller-0.23.5
art-shutter marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 6 additions & 0 deletions lib/modules/manager/github-actions/extract.spec.ts
Expand Up @@ -397,6 +397,12 @@ describe('modules/manager/github-actions/extract', () => {
replaceString:
'actions/checkout@689fcce700ae7ffc576f2b029b51b2ffb66d3abd # ratchet:exclude',
},
{
currentDigest: 'f1d7c52253b89f0beae60141f8465d9495cdc2cf',
currentValue: 'actions-runner-controller-0.23.5',
replaceString:
'actions-runner-controller/execute-assert-arc-e2e@f1d7c52253b89f0beae60141f8465d9495cdc2cf # actions-runner-controller-0.23.5',
},
]);
});

Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/github-actions/extract.ts
Expand Up @@ -15,7 +15,7 @@ import type { Workflow } from './types';

const dockerActionRe = regEx(/^\s+uses\s*: ['"]?docker:\/\/([^'"]+)\s*$/);
const actionRe = regEx(
/^\s+-?\s+?uses\s*: (?<replaceString>['"]?(?<registryUrl>https:\/\/[.\w-]+\/)?(?<depName>[\w-]+\/[.\w-]+)(?<path>\/.*)?@(?<currentValue>[^\s'"]+)['"]?(?:\s+#\s*(((?:renovate\s*:\s*)?(?:pin\s+|tag\s*=\s*)?|(?:ratchet:[\w-]+\/[.\w-]+)?)@?(?<tag>v?\d+(?:\.\d+(?:\.\d+)?)?)|(?:ratchet:exclude)))?)/,
/^\s+-?\s+?uses\s*: (?<replaceString>['"]?(?<registryUrl>https:\/\/[.\w-]+\/)?(?<depName>[\w-]+\/[.\w-]+)(?<path>\/.*)?@(?<currentValue>[^\s'"]+)['"]?(?:\s+#\s*(((?:renovate\s*:\s*)?(?:pin\s+|tag\s*=\s*)?|(?:ratchet:[\w-]+\/[.\w-]+)?)@?(?<tag>([\w-]*-)?v?\d+(?:\.\d+(?:\.\d+)?)?)|(?:ratchet:exclude)))?)/,
rarkins marked this conversation as resolved.
Show resolved Hide resolved
);

// SHA1 or SHA256, see https://github.blog/2020-10-19-git-2-29-released/
Expand Down
3 changes: 2 additions & 1 deletion lib/modules/manager/github-actions/readme.md
@@ -1,7 +1,8 @@
The `github-actions` manager extracts dependencies from GitHub Actions workflow and workflow template files.
It can also be used for Gitea and Forgejo Actions workflows as such are compatible with GitHub Actions workflows.

If you like to use digest pinning but want to follow the action version tag, you can use the following sample:
If you like to use digest pinning but want to follow the action version tag, you can use the sample below.
The version tag can be in the format `(prefix-)(v)1.0.0`, where `prefix` and `v` are optional and `1.0.0` is the version number.
rarkins marked this conversation as resolved.
Show resolved Hide resolved

```yaml
name: build
Expand Down