@@ -120,24 +120,13 @@ runs:
120120 return core.setFailed(`Package tarball download path does not exist: ${downloadPath}`);
121121 }
122122
123- function findTarballs(directory) {
124- return fs.readdirSync(directory, { withFileTypes: true }).flatMap(entry => {
125- const entryPath = path.join(directory, entry.name);
126-
127- if (entry.isDirectory()) {
128- return findTarballs(entryPath);
129- }
130-
131- if (entry.isFile() && entry.name.endsWith('.tgz')) {
132- return [entryPath];
133- }
134-
135- return [];
136- });
137- }
138-
123+ const globber = await glob.create(path.join(downloadPath, '**/*.tgz'), {
124+ followSymbolicLinks: false,
125+ matchDirectories: false,
126+ implicitDescendants: false,
127+ });
139128 const packageTarballPaths = fs.statSync(downloadPath).isDirectory()
140- ? findTarballs(downloadPath )
129+ ? (await globber.glob()).filter(file => fs.lstatSync(file).isFile() )
141130 : downloadPath.endsWith('.tgz') ? [downloadPath] : [];
142131
143132 if (packageTarballPaths.length === 0) {
@@ -159,9 +148,9 @@ runs:
159148 PACKAGE_TARBALL_PATH : ${{ steps.package-tarball.outputs.path }}
160149 with :
161150 script : |
162- const { execFileSync } = require('node:child_process');
163151 const tarballPath = process.env.PACKAGE_TARBALL_PATH;
164- const { name, version } = JSON.parse(execFileSync('tar', ['-xOf', tarballPath, 'package/package.json'], { encoding: 'utf8' }));
152+ const { stdout } = await exec.getExecOutput('tar', ['-xOf', tarballPath, 'package/package.json'], { silent: true });
153+ const { name, version } = JSON.parse(stdout);
165154 core.setOutput('name', name);
166155 core.setOutput('version', version);
167156
0 commit comments