isActionRepo()
This commit is contained in:
@@ -91,6 +91,14 @@ export function isDirectory(dirPath: string): boolean {
|
||||
return fs.existsSync(dirPath) && fs.lstatSync(dirPath).isDirectory()
|
||||
}
|
||||
|
||||
export function isActionRepo(stagingDir: string): boolean {
|
||||
return (
|
||||
fs.existsSync(path.join(stagingDir, 'action.yml')) ||
|
||||
fs.existsSync(path.join(stagingDir, 'action.yaml'))
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
export function readFileContents(filePath: string): Buffer {
|
||||
return fs.readFileSync(filePath)
|
||||
}
|
||||
@@ -116,6 +124,7 @@ export function bundleFilesintoDirectory(
|
||||
return targetDir
|
||||
}
|
||||
|
||||
|
||||
// Converts a file path to a filemetadata object by querying the fs for relevant metadata.
|
||||
async function fileMetadata(filePath: string): Promise<FileMetadata> {
|
||||
const stats = fs.statSync(filePath)
|
||||
|
||||
@@ -65,6 +65,13 @@ export async function run(pathInput: string): Promise<void> {
|
||||
path = fsHelper.bundleFilesintoDirectory(paths, bundleDir)
|
||||
}
|
||||
|
||||
if (!fsHelper.isActionRepo(path)) {
|
||||
core.setFailed(
|
||||
'action.y(a)ml not found. Action packages can be created only for action repositories.'
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
// Create a temporary directory to store the archives
|
||||
const archiveDir = fsHelper.createTempDir()
|
||||
tmpDirs.push(archiveDir)
|
||||
|
||||
Reference in New Issue
Block a user