From b30eee16868144e1b69a031a6ee5acccc145fee0 Mon Sep 17 00:00:00 2001 From: Corey Butler Date: Thu, 2 Apr 2020 23:38:10 -0500 Subject: [PATCH] Fixed path issues in regex strategy --- app/lib/docker.js | 2 +- app/lib/regex.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/lib/docker.js b/app/lib/docker.js index b9c767b..c177ded 100644 --- a/app/lib/docker.js +++ b/app/lib/docker.js @@ -6,7 +6,7 @@ import core from '@actions/core' export default class Dockerfile extends Regex { constructor (root = null) { root = path.join(process.env.GITHUB_WORKSPACE, root) - core.debug(fs.readdirSync(root)) + if (fs.statSync(root).isDirectory()) { root = path.join(root, 'Dockerfile') } diff --git a/app/lib/regex.js b/app/lib/regex.js index c34ba90..a86d1df 100644 --- a/app/lib/regex.js +++ b/app/lib/regex.js @@ -2,8 +2,8 @@ import fs from 'fs' import path from 'path' export default class Regex { - constructor (root = null, pattern) { - root = path.join(process.env.GITHUB_WORKSPACE, root) + constructor (root = './', pattern) { + root = path.resolve(root) if (fs.statSync(root).isDirectory()) { throw new Error(`${root} is a directory. The Regex tag identification strategy requires a file.`)