Skip to content

Commit

Permalink
fix(githubActions): handle container as object
Browse files Browse the repository at this point in the history
  • Loading branch information
bodinsamuel committed Nov 6, 2023
1 parent 221b044 commit d5f3fa9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/rules/spec/githubActions/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface GitHubActionsFile {
jobs: Record<
string,
{
container?: string; // interesting
container?: string | { image: string; options?: string }; // interesting
'runs-on': string;
'timeout-minutes': number;
env?: Record<string, string>;
Expand Down Expand Up @@ -74,7 +74,10 @@ export const detectGithubActionsComponent: ComponentMatcher = async (
}

if (config.container) {
const [imageName, imageVersion] = config.container.split(':');
const [imageName, imageVersion] =
typeof config.container === 'string'
? config.container.split(':')
: config.container.image;
dependencies.push(['docker', imageName, imageVersion || 'latest']);
const matched = matchDependencies([imageName], 'docker');
if (matched.size > 0) {
Expand All @@ -87,6 +90,7 @@ export const detectGithubActionsComponent: ComponentMatcher = async (
if (!service.image) {
continue;
}

const [imageName, imageVersion] = service.image.split(':');
dependencies.push(['docker', imageName, imageVersion || 'latest']);
const matched = matchDependencies([imageName], 'docker');
Expand Down

0 comments on commit d5f3fa9

Please sign in to comment.