forked from devonfw-tutorials/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetPlaybookCheckout.js
More file actions
29 lines (25 loc) · 782 Bytes
/
getPlaybookCheckout.js
File metadata and controls
29 lines (25 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const core = require("@actions/core");
const { Octokit } = require("@octokit/core");
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
async function getPlaybookCheckout() {
let pr = process.env.PR_NUMBER;
let head = "";
try {
let get = await octokit.request('GET /repos/{owner}/{repo}/pulls/{pull_number}', {
owner: 'devonfw-tutorials',
repo: 'tutorials',
pull_number: pr
});
head = get.data.head;
} catch(e) {
throw e;
}
core.info(`ref: ${head.ref}`);
core.setOutput('ref', head.ref);
core.info(`name : ${head.user.login}`);
core.setOutput('name', head.user.login);
}
getPlaybookCheckout().catch(err => {
console.log(err);
process.exit(1);
});