Skip to content

add first parent option #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ inputs:
description: "to tag"
required: false
default: "latest"
first-parent:
description: "whether use --first-parent ro not"
required: false
default: true
runs:
using: "node12"
main: "dist/index.js"
Expand Down
4 changes: 3 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,7 @@ function run() {
return __awaiter(this, void 0, void 0, function* () {
const from = core.getInput('from');
const to = core.getInput('to');
const shouldUseFirstParent = core.getInput('first-parent');
let output = '';
const options = {
listeners: {
Expand All @@ -1044,7 +1045,8 @@ function run() {
core.setFailed('from or to is invalid');
return;
}
const command = `git log ${fromTag}..${toTag} --merges --reverse --pretty=format:"* %b"`;
const firstParentOption = shouldUseFirstParent ? '--first-parent' : '';
const command = `git log ${fromTag}..${toTag} --merges ${firstParentOption} --reverse --pretty=format:"* %b"`;
core.info(command);
yield exec.exec(command, [], options).catch(error => {
core.setFailed(error.message);
Expand Down
4 changes: 3 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function getTag(tags: string[], name: string): string {
async function run(): Promise<void> {
const from = core.getInput('from')
const to = core.getInput('to')
const shouldUseFirstParent = core.getInput('first-parent')

let output = ''
const options = {
Expand Down Expand Up @@ -48,7 +49,8 @@ async function run(): Promise<void> {
return
}

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

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