Allow to overwrite on copy to temp folder

Show changed files in group
This commit is contained in:
CrazyMax 2020-11-11 22:44:04 +01:00
parent 5170a3af56
commit 45b1e3298a
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
4 changed files with 16 additions and 10 deletions

View File

@ -19,6 +19,7 @@ jobs:
name: Gen dummy page name: Gen dummy page
run: | run: |
mkdir public mkdir public
touch public/file{0001..3000}
cat > public/index.html <<EOL cat > public/index.html <<EOL
<!doctype html> <!doctype html>
<html> <html>

12
dist/index.js generated vendored
View File

@ -183,9 +183,9 @@ function commit(allowEmptyCommit, author, message) {
}); });
} }
exports.commit = commit; exports.commit = commit;
function showStat(count) { function showStat() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
return yield git(['show', `--stat-count=${count}`, 'HEAD']).then(output => { return yield git(['show', `--stat-count=2000`, 'HEAD']).then(output => {
return output; return output;
}); });
}); });
@ -301,6 +301,8 @@ function run() {
} }
core.info(`🏃 Copying ${path.join(currentdir, buildDir)} contents to ${tmpdir}`); core.info(`🏃 Copying ${path.join(currentdir, buildDir)} contents to ${tmpdir}`);
yield fs_extra_1.copySync(path.join(currentdir, buildDir), tmpdir, { yield fs_extra_1.copySync(path.join(currentdir, buildDir), tmpdir, {
overwrite: true,
errorOnExist: false,
dereference: true dereference: true
}); });
if (fqdn) { if (fqdn) {
@ -327,16 +329,16 @@ function run() {
} }
core.info(`📐 Updating index of working tree`); core.info(`📐 Updating index of working tree`);
yield git.add('.'); yield git.add('.');
core.info(`📦 Committing changes`);
if (allowEmptyCommit) { if (allowEmptyCommit) {
core.info(`✅ Allow empty commit`); core.info(`✅ Allow empty commit`);
} }
const authorPrs = addressparser_1.default(author)[0]; const authorPrs = addressparser_1.default(author)[0];
core.info(`🔨 Configuring git author as ${authorPrs.name} <${authorPrs.address}>`); core.startGroup(`📦 Committing changes as ${authorPrs.name} <${authorPrs.address}> author`);
yield git.commit(allowEmptyCommit, `${authorPrs.name} <${authorPrs.address}>`, commitMessage); yield git.commit(allowEmptyCommit, `${authorPrs.name} <${authorPrs.address}>`, commitMessage);
yield git.showStat(10).then(output => { yield git.showStat().then(output => {
core.info(output); core.info(output);
}); });
core.endGroup();
core.info(`🏃 Pushing ${buildDir} directory to ${targetBranch} branch on ${repo} repo`); core.info(`🏃 Pushing ${buildDir} directory to ${targetBranch} branch on ${repo} repo`);
if (!keepHistory) { if (!keepHistory) {
core.info(`✅ Force push`); core.info(`✅ Force push`);

View File

@ -67,8 +67,8 @@ export async function commit(allowEmptyCommit: boolean, author: string, message:
await git(args); await git(args);
} }
export async function showStat(count: number): Promise<string> { export async function showStat(): Promise<string> {
return await git(['show', `--stat-count=${count}`, 'HEAD']).then(output => { return await git(['show', `--stat-count=2000`, 'HEAD']).then(output => {
return output; return output;
}); });
} }

View File

@ -58,6 +58,8 @@ async function run() {
core.info(`🏃 Copying ${path.join(currentdir, buildDir)} contents to ${tmpdir}`); core.info(`🏃 Copying ${path.join(currentdir, buildDir)} contents to ${tmpdir}`);
await copySync(path.join(currentdir, buildDir), tmpdir, { await copySync(path.join(currentdir, buildDir), tmpdir, {
overwrite: true,
errorOnExist: false,
dereference: true dereference: true
}); });
@ -91,16 +93,17 @@ async function run() {
core.info(`📐 Updating index of working tree`); core.info(`📐 Updating index of working tree`);
await git.add('.'); await git.add('.');
core.info(`📦 Committing changes`);
if (allowEmptyCommit) { if (allowEmptyCommit) {
core.info(`✅ Allow empty commit`); core.info(`✅ Allow empty commit`);
} }
const authorPrs: addressparser.Address = addressparser(author)[0]; 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.commit(allowEmptyCommit, `${authorPrs.name} <${authorPrs.address}>`, commitMessage);
await git.showStat(10).then(output => { await git.showStat().then(output => {
core.info(output); core.info(output);
}); });
core.endGroup();
core.info(`🏃 Pushing ${buildDir} directory to ${targetBranch} branch on ${repo} repo`); core.info(`🏃 Pushing ${buildDir} directory to ${targetBranch} branch on ${repo} repo`);
if (!keepHistory) { if (!keepHistory) {