Skip to content

Commit dff7ab6

Browse files
committed
add first parent option
1 parent a16e6c6 commit dff7ab6

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ inputs:
99
description: "to tag"
1010
required: false
1111
default: "latest"
12+
first-parent:
13+
description: "whether use --first-parent ro not"
14+
required: false
15+
default: true
1216
runs:
1317
using: "node12"
1418
main: "dist/index.js"

dist/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,7 @@ function run() {
10221022
return __awaiter(this, void 0, void 0, function* () {
10231023
const from = core.getInput('from');
10241024
const to = core.getInput('to');
1025+
const shouldUseFirstParent = core.getInput('first-parent');
10251026
let output = '';
10261027
const options = {
10271028
listeners: {
@@ -1044,7 +1045,8 @@ function run() {
10441045
core.setFailed('from or to is invalid');
10451046
return;
10461047
}
1047-
const command = `git log ${fromTag}..${toTag} --merges --reverse --pretty=format:"* %b"`;
1048+
const firstParentOption = shouldUseFirstParent ? '--first-parent' : '';
1049+
const command = `git log ${fromTag}..${toTag} --merges ${firstParentOption} --reverse --pretty=format:"* %b"`;
10481050
core.info(command);
10491051
yield exec.exec(command, [], options).catch(error => {
10501052
core.setFailed(error.message);

src/main.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ function getTag(tags: string[], name: string): string {
1919
async function run(): Promise<void> {
2020
const from = core.getInput('from')
2121
const to = core.getInput('to')
22+
const shouldUseFirstParent = core.getInput('first-parent')
2223

2324
let output = ''
2425
const options = {
@@ -48,7 +49,8 @@ async function run(): Promise<void> {
4849
return
4950
}
5051

51-
const command = `git log ${fromTag}..${toTag} --merges --reverse --pretty=format:"* %b"`
52+
const firstParentOption = shouldUseFirstParent ? '--first-parent' : ''
53+
const command = `git log ${fromTag}..${toTag} --merges ${firstParentOption} --reverse --pretty=format:"* %b"`
5254
core.info(command)
5355

5456
await exec.exec(command, [], options).catch(error => {

0 commit comments

Comments
 (0)