Skip to content

Commit e10c1dd

Browse files
author
Irene Alvarado
committed
Add post action run script to commit all files instead of committing per step
1 parent e298798 commit e10c1dd

File tree

8 files changed

+1755
-49
lines changed

8 files changed

+1755
-49
lines changed

action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ outputs:
2727
runs:
2828
using: 'node12'
2929
main: 'dist/index.js'
30+
post: 'dist/post/index.js'
3031
branding:
3132
color: 'purple'
3233
icon: 'download-cloud'

dist/index.js

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -498,20 +498,13 @@ async function run() {
498498
const bytes = await git_1.diff(filename);
499499
core.setOutput('delta_bytes', bytes);
500500
core.endGroup();
501-
if (bytes === 0) {
502-
return;
503-
}
504501
core.startGroup('Committing new data');
505-
const sign = bytes >= 0 ? '+' : '';
506-
const date = new Date().toISOString();
507-
const msg = `Latest data: ${date} (${sign}${bytes}b)`;
508-
const meta = JSON.stringify({
509-
files: [{ name: filename, deltaBytes: bytes, date, source }],
510-
}, undefined, 2);
511-
core.info(`Committing "${msg}"`);
512-
core.debug(meta);
513-
await exec_1.exec('git', ['commit', '-m', msg + '\n' + meta]);
514-
await exec_1.exec('git', ['push']);
502+
const alreadyEditedFiles = JSON.parse(process.env.FILES || "[]");
503+
core.info("alreadyEditedFiles");
504+
core.info(JSON.stringify(alreadyEditedFiles));
505+
const newFiles = [{ name: filename, deltaBytes: bytes, source }]; // TODO: add other files
506+
const files = [...alreadyEditedFiles, ...newFiles];
507+
core.exportVariable('FILES', files);
515508
core.endGroup();
516509
}
517510
run().catch(error => {

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)