-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
23 lines (21 loc) · 682 Bytes
/
index.js
File metadata and controls
23 lines (21 loc) · 682 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const core = require('@actions/core');
const { exec } = require('child_process');
const { Shescape } = require('shescape');
try {
const shescape = new Shescape({ shell: true });
const quote = shescape.quote.bind(shescape);
const sha = core.getInput('sha') || process.env.GITHUB_SHA;
exec(`git log --format=%B -n 1 ${quote(sha)}`, (err, stdout, stderr) => {
if (err) {
throw err;
}
core.setOutput("git-message", stdout);
const lines = stdout.split("\n");
const title = lines.shift();
const body = lines.join("\n");
core.setOutput("title", title);
core.setOutput("body", body);
});
} catch (error) {
core.setFailed(error.message);
}