mirror of
https://github.com/peaceiris/actions-gh-pages.git
synced 2026-10-03 10:01:37 +00:00
feat: dst_sha
This commit is contained in:
3 files changed
+22
-2
No files matched your search
@@ -77,3 +77,6 @@ inputs:
|
|||||||
description: 'Set files or directories to exclude from a publish directory.'
|
description: 'Set files or directories to exclude from a publish directory.'
|
||||||
required: false
|
required: false
|
||||||
default: '.github'
|
default: '.github'
|
||||||
|
outputs:
|
||||||
|
dst_sha:
|
||||||
|
description: 'Deployed commit hash.'
|
||||||
+17
-1
@@ -190,16 +190,32 @@ export function getCommitMessage(
|
|||||||
return subject;
|
return subject;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function commit(allowEmptyCommit: boolean, msg: string): Promise<void> {
|
export async function commit(allowEmptyCommit: boolean, msg: string): Promise<string> {
|
||||||
try {
|
try {
|
||||||
if (allowEmptyCommit) {
|
if (allowEmptyCommit) {
|
||||||
await exec.exec('git', ['commit', '--allow-empty', '-m', `${msg}`]);
|
await exec.exec('git', ['commit', '--allow-empty', '-m', `${msg}`]);
|
||||||
} else {
|
} else {
|
||||||
await exec.exec('git', ['commit', '-m', `${msg}`]);
|
await exec.exec('git', ['commit', '-m', `${msg}`]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const result: CmdResult = {
|
||||||
|
exitcode: 0,
|
||||||
|
output: ''
|
||||||
|
};
|
||||||
|
const options = {
|
||||||
|
listeners: {
|
||||||
|
stdout: (data: Buffer): void => {
|
||||||
|
result.output += data.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
result.exitcode = await exec.exec('git', ['rev-parse', 'HEAD'], options);
|
||||||
|
|
||||||
|
return result.output;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
core.info('[INFO] skip commit');
|
core.info('[INFO] skip commit');
|
||||||
core.debug(`[INFO] skip commit ${e.message}`);
|
core.debug(`[INFO] skip commit ${e.message}`);
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -75,7 +75,8 @@ export async function run(): Promise<void> {
|
|||||||
baseRepo,
|
baseRepo,
|
||||||
hash
|
hash
|
||||||
);
|
);
|
||||||
await commit(inps.AllowEmptyCommit, commitMessage);
|
const dstSHA = await commit(inps.AllowEmptyCommit, commitMessage);
|
||||||
|
core.setOutput('dst_sha', dstSHA);
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
|
|
||||||
core.startGroup('Push the commit or tag');
|
core.startGroup('Push the commit or tag');
|
||||||
|
|||||||
Reference in new issue
Block a user