Skip to content

Commit 18be27c

Browse files
committed
fix package check script
1 parent 2687235 commit 18be27c

File tree

2 files changed

+31
-118
lines changed

2 files changed

+31
-118
lines changed

action.yaml

Lines changed: 0 additions & 111 deletions
This file was deleted.

shared/scripts/check-packages.js

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
import { execSync } from 'child_process';
8-
import { readFileSync, readdirSync } from 'fs';
8+
import { readFileSync, readdirSync, accessSync, constants } from 'fs';
99
import { join } from 'path';
1010

1111
const packagesDir = 'packages';
@@ -40,17 +40,41 @@ function checkPackage(packageName) {
4040
const actionYml = join(packagePath, 'action.yml');
4141
const actionYaml = join(packagePath, 'action.yaml');
4242

43+
let actionFileFound = false;
44+
let actionFileError = null;
45+
46+
// Check for action.yml
4347
try {
48+
accessSync(actionYml, constants.F_OK);
4449
readFileSync(actionYml);
4550
console.log(` ✅ Has action.yml file`);
46-
} catch {
47-
try {
48-
readFileSync(actionYaml);
49-
console.log(` ✅ Has action.yaml file`);
50-
} catch {
51-
console.log(` ❌ Missing action.yml/action.yaml file`);
51+
actionFileFound = true;
52+
} catch (error) {
53+
if (error.code === 'ENOENT') {
54+
// File doesn't exist, try action.yaml
55+
try {
56+
accessSync(actionYaml, constants.F_OK);
57+
readFileSync(actionYaml);
58+
console.log(` ✅ Has action.yaml file`);
59+
actionFileFound = true;
60+
} catch (yamlError) {
61+
if (yamlError.code === 'ENOENT') {
62+
console.log(` ❌ Missing action.yml/action.yaml file`);
63+
} else {
64+
console.log(` ❌ Error reading action.yaml: ${yamlError.message}`);
65+
actionFileError = yamlError;
66+
}
67+
}
68+
} else {
69+
console.log(` ❌ Error reading action.yml: ${error.message}`);
70+
actionFileError = error;
5271
}
5372
}
73+
74+
// If we found an action file but had read errors, report them
75+
if (actionFileFound && actionFileError) {
76+
console.log(` ⚠️ Action file found but has read issues: ${actionFileError.message}`);
77+
}
5478
} catch (error) {
5579
console.log(` ❌ Error reading package.json: ${error.message}`);
5680
}

0 commit comments

Comments
 (0)