Skip to content

Commit

Permalink
update build
Browse files Browse the repository at this point in the history
  • Loading branch information
phungtruongnguyen94 committed Feb 8, 2022
1 parent db343a2 commit e96598c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion index.js

Large diffs are not rendered by default.

24 changes: 11 additions & 13 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import path from 'path';
import fs from 'fs';
import fse from 'fs-extra'
import { getInput, setFailed, startGroup, endGroup, debug } from '@actions/core';
import { context, getOctokit } from '@actions/github';
import { exec } from '@actions/exec';
Expand Down Expand Up @@ -67,22 +66,11 @@ async function run(octokit, context, token, privateConfig) {
console.log("new size:")
console.log(newSizes)

const originDir = process.cwd()
const workDir = getInput('cwd')
process.chdir("../")
if (!fs.existsSync(workDir)){
fs.mkdirSync(workDir);
fse.copySync(originDir, process.cwd() + workDir.replace(".", ""), {
overwrite: true,
filter: path => path.indexOf(workDir.replace("./", "")) > -1
})
process.chdir(workDir)
console.log(`change dir to ${workDir}`)
} else {
fse.copySync(originDir, process.cwd() + workDir.replace(".", ""), {
overwrite: true,
filter: path => path.indexOf(workDir.replace("./", "")) > -1
})
process.chdir(workDir)
console.log(`change dir to ${workDir}`)
}
Expand Down Expand Up @@ -144,7 +132,17 @@ async function run(octokit, context, token, privateConfig) {
startGroup(`[base] Build using ${npm}`);
await exec(`${npm} run ${buildScript}`);
endGroup();

fs.readdir(process.cwd(), function (err, files) {
//handling error
if (err) {
return console.log('Unable to scan directory: ' + err);
}
//listing all files using forEach
files.forEach(function (file) {
// Do whatever you want to do with the file
console.log(file);
});
});
// In case the build step alters a JSON-file, ....
await exec(`git reset --hard`);
console.log("get old sizes")
Expand Down

0 comments on commit e96598c

Please sign in to comment.