mirror of
https://github.com/papeloto/action-zip
synced 2024-11-22 05:29:35 -08:00
fix: missing forward slash
This commit is contained in:
parent
a1b75eab61
commit
a77ec1c880
2 changed files with 10 additions and 10 deletions
10
dist/index.js
vendored
10
dist/index.js
vendored
|
@ -70,20 +70,20 @@ console.log(`Ready to zip "${files}" into ${output}`);
|
|||
const zip = new AdmZip();
|
||||
|
||||
files.forEach(file => {
|
||||
const filename = file.replace(process.env.GITHUB_WORKSPACE, "");
|
||||
const filename = file.replace(`${process.env.GITHUB_WORKSPACE}/`, "");
|
||||
|
||||
if (!fs.existsSync(filename)) {
|
||||
if (!fs.existsSync(file)) {
|
||||
console.log(` - ${filename} (Not Found)`);
|
||||
return;
|
||||
}
|
||||
|
||||
const dir = path.dirname(filename);
|
||||
const stats = fs.lstatSync(filename);
|
||||
const stats = fs.lstatSync(file);
|
||||
|
||||
if (stats.isDirectory()) {
|
||||
zip.addLocalFolder(filename, dir);
|
||||
zip.addLocalFolder(file, dir);
|
||||
} else {
|
||||
zip.addLocalFile(filename, dir === "." ? "" : dir);
|
||||
zip.addLocalFile(file, dir === "." ? "" : dir);
|
||||
}
|
||||
|
||||
console.log(` - ${filename}`);
|
||||
|
|
10
index.js
10
index.js
|
@ -15,20 +15,20 @@ console.log(`Ready to zip "${files}" into ${output}`);
|
|||
const zip = new AdmZip();
|
||||
|
||||
files.forEach(file => {
|
||||
const filename = file.replace(process.env.GITHUB_WORKSPACE, "");
|
||||
const filename = file.replace(`${process.env.GITHUB_WORKSPACE}/`, "");
|
||||
|
||||
if (!fs.existsSync(filename)) {
|
||||
if (!fs.existsSync(file)) {
|
||||
console.log(` - ${filename} (Not Found)`);
|
||||
return;
|
||||
}
|
||||
|
||||
const dir = path.dirname(filename);
|
||||
const stats = fs.lstatSync(filename);
|
||||
const stats = fs.lstatSync(file);
|
||||
|
||||
if (stats.isDirectory()) {
|
||||
zip.addLocalFolder(filename, dir);
|
||||
zip.addLocalFolder(file, dir);
|
||||
} else {
|
||||
zip.addLocalFile(filename, dir === "." ? "" : dir);
|
||||
zip.addLocalFile(file, dir === "." ? "" : dir);
|
||||
}
|
||||
|
||||
console.log(` - ${filename}`);
|
||||
|
|
Loading…
Reference in a new issue