-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchangeLogger.js
More file actions
37 lines (28 loc) · 1.3 KB
/
Copy pathchangeLogger.js
File metadata and controls
37 lines (28 loc) · 1.3 KB
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
29
30
31
32
33
34
35
36
37
//Libs
const github = require('@actions/github');
const { Octokit } = require("@octokit/core");
const core = require('@actions/core');
//Scripts
const { getPRInformation } = require('./utils/getPRInformation');
const { getNewTagVersion } = require('./utils/getLatestTag');
const { appendToChangelog } = require('./utils/appendToChangelog');
const { createTag } = require('./utils/createTag');
async function main() {
const context = github.context;
const changelogRelativePath = core.getInput("changelogPath");
const commitEmail = core.getInput("commitEmail");
const commitUserName = core.getInput("commitUserName");
const shouldCreateNewTag = core.getInput("shouldCreateNewTag");
const githubToken = core.getInput("githubToken");
const octokit = new Octokit({ auth: githubToken });
const prNumber = context.payload.pull_request.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
const prData = await getPRInformation(octokit, prNumber, owner, repo);
const nextVersion = await getNewTagVersion(prData.title, octokit, owner, repo);
if (shouldCreateNewTag === "true") {
await createTag(octokit, prData, owner, repo, nextVersion);
}
appendToChangelog(prData, nextVersion, changelogRelativePath, commitEmail, commitUserName);
}
main();