Skip to content

Commit

Permalink
Allow to overwrite on copy to temp folder
Browse files Browse the repository at this point in the history
Show changed files in group
  • Loading branch information
crazy-max committed Nov 11, 2020
1 parent 5170a3a commit 45b1e32
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
name: Gen dummy page
run: |
mkdir public
touch public/file{0001..3000}
cat > public/index.html <<EOL
<!doctype html>
<html>
Expand Down
12 changes: 7 additions & 5 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ export async function commit(allowEmptyCommit: boolean, author: string, message:
await git(args);
}

export async function showStat(count: number): Promise<string> {
return await git(['show', `--stat-count=${count}`, 'HEAD']).then(output => {
export async function showStat(): Promise<string> {
return await git(['show', `--stat-count=2000`, 'HEAD']).then(output => {
return output;
});
}
Expand Down
9 changes: 6 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ async function run() {

core.info(`πŸƒ Copying ${path.join(currentdir, buildDir)} contents to ${tmpdir}`);
await copySync(path.join(currentdir, buildDir), tmpdir, {
overwrite: true,
errorOnExist: false,
dereference: true
});

Expand Down Expand Up @@ -91,16 +93,17 @@ async function run() {
core.info(`πŸ“ Updating index of working tree`);
await git.add('.');

core.info(`πŸ“¦ Committing changes`);
if (allowEmptyCommit) {
core.info(`βœ… Allow empty commit`);
}

const authorPrs: addressparser.Address = addressparser(author)[0];
core.info(`πŸ”¨ Configuring git author as ${authorPrs.name} <${authorPrs.address}>`);
core.startGroup(`πŸ“¦ Committing changes as ${authorPrs.name} <${authorPrs.address}> author`);
await git.commit(allowEmptyCommit, `${authorPrs.name} <${authorPrs.address}>`, commitMessage);
await git.showStat(10).then(output => {
await git.showStat().then(output => {
core.info(output);
});
core.endGroup();

core.info(`πŸƒ Pushing ${buildDir} directory to ${targetBranch} branch on ${repo} repo`);
if (!keepHistory) {
Expand Down

0 comments on commit 45b1e32

Please sign in to comment.