mirror of
				https://github.com/ButlerLogic/action-autotag.git
				synced 2025-10-31 23:36:22 +07:00 
			
		
		
		
	Only import what is necessary
This commit is contained in:
		| @ -1,14 +1,13 @@ | ||||
| import Regex from './regex.js' | ||||
| import path from 'path' | ||||
| import fs from 'fs' | ||||
| import core from '@actions/core' | ||||
| import { join } from 'path' | ||||
| import { statSync } from 'fs' | ||||
|  | ||||
| export default class Dockerfile extends Regex { | ||||
|   constructor (root = null) { | ||||
|     root = path.join(process.env.GITHUB_WORKSPACE, root) | ||||
|     root = join(process.env.GITHUB_WORKSPACE, root) | ||||
|  | ||||
|     if (fs.statSync(root).isDirectory()) { | ||||
|       root = path.join(root, 'Dockerfile') | ||||
|     if (statSync(root).isDirectory()) { | ||||
|       root = join(root, 'Dockerfile') | ||||
|     } | ||||
|  | ||||
|     super(root, /LABEL[\s\t]+version=[\t\s+]?[\"\']?([0-9\.]+)[\"\']?/i) | ||||
|  | ||||
| @ -1,19 +1,19 @@ | ||||
| import fs from 'fs' | ||||
| import path from 'path' | ||||
| import { statSync, readFileSync } from 'fs' | ||||
| import { resolve } from 'path' | ||||
|  | ||||
| export default class Regex { | ||||
|   constructor (root = './', pattern) { | ||||
|     root = path.resolve(root) | ||||
|     root = resolve(root) | ||||
|  | ||||
|     if (fs.statSync(root).isDirectory()) { | ||||
|     if (statSync(root).isDirectory()) { | ||||
|       throw new Error(`${root} is a directory. The Regex tag identification strategy requires a file.`) | ||||
|     } | ||||
|  | ||||
|     if (!fs.existsSync(root)) { | ||||
|     if (!existsSync(root)) { | ||||
|       throw new Error(`"${root}" does not exist.`) | ||||
|     } | ||||
|  | ||||
|     this.content = fs.readFileSync(root).toString() | ||||
|     this.content = readFileSync(root).toString() | ||||
|  | ||||
|     let content = pattern.exec(this.content) | ||||
|     if (!content) { | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| import core from '@actions/core' | ||||
| import fs from 'fs' | ||||
| import { readdirSync } from 'fs' | ||||
| import path from 'path' | ||||
|  | ||||
| export default class Setup { | ||||
| @ -11,8 +11,7 @@ export default class Setup { | ||||
|         .join('\n -> ')}` | ||||
|     ) | ||||
|  | ||||
|     const dir = fs | ||||
|       .readdirSync(path.resolve(process.env.GITHUB_WORKSPACE), { withFileTypes: true }) | ||||
|     const dir = readdirSync(path.resolve(process.env.GITHUB_WORKSPACE), { withFileTypes: true }) | ||||
|       .map(entry => { | ||||
|         return `${entry.isDirectory() ? '> ' : '  - '}${entry.name}` | ||||
|       }) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Corey Butler
					Corey Butler