Skip to content
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

Feature Request: Ignore Fail #14

Merged
merged 5 commits into from
Aug 16, 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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ jobs:
| merge_method | ✅ | merge | merge, rebase or squash |
| pr_title | ✅ | Fork Sync | Title of the created pull request |
| pr_message | ✅ | | Message of the created pull request |
| ignore_fail | ✅ | | Ignore Exceptions |
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ inputs:
pr_message:
description: 'The message in the pull request'
required: false
ignore_fail:
description: 'ignore Exceptions'
required: false

runs:
using: 'node12'
Expand Down
7 changes: 5 additions & 2 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function run() {
const mergeMethod = core.getInput('merge_method', { required: false });
const prTitle = core.getInput('pr_title', { required: false });
const prMessage = core.getInput('pr_message', { required: false });
const ignoreFail = core.getInput('ignore_fail', { required: false });
try {
let pr = yield octokit.pulls.create({ owner: context.repo.owner, repo: context.repo.repo, title: prTitle, head: owner + ':' + head, base: base, body: prMessage, merge_method: mergeMethod, maintainer_can_modify: false });
yield octokit.pulls.merge({ owner: context.repo.owner, repo: context.repo.repo, pull_number: pr.data.number });
Expand All @@ -39,8 +40,10 @@ function run() {
console.log('No commits between ' + context.repo.owner + ':' + base + ' and ' + owner + ':' + head);
}
else {
console.log(error);
core.setFailed('Failed to create or merge pull request');
if (!ignoreFail) {
console.log(error);
core.setFailed('Failed to create or merge pull request');
}
}
}
});
Expand Down
9 changes: 6 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ async function run() {
const mergeMethod = core.getInput('merge_method', { required: false });
const prTitle = core.getInput('pr_title', { required: false });
const prMessage = core.getInput('pr_message', { required: false });
const ignoreFail = core.getInput('ignore_fail', { required: false });

try {
let pr = await octokit.pulls.create({ owner: context.repo.owner, repo: context.repo.repo, title: prTitle, head: owner + ':' + head, base: base, body: prMessage, merge_method: mergeMethod, maintainer_can_modify: false });
Expand All @@ -20,10 +21,12 @@ async function run() {
if (!!error.errors && error.errors[0].message == 'No commits between ' + context.repo.owner + ':' + base + ' and ' + owner + ':' + head) {
console.log('No commits between ' + context.repo.owner + ':' + base + ' and ' + owner + ':' + head);
} else {
console.log(error)
core.setFailed('Failed to create or merge pull request');
if (!ignoreFail) {
console.log(error);
core.setFailed('Failed to create or merge pull request');
}
}
}
}

run();
run();