Skip to content

Commit

Permalink
Merge pull request #17 from erichbehrens/fix/rendering-error
Browse files Browse the repository at this point in the history
Fix rendering error for repositories without tests
  • Loading branch information
erichbehrens authored Apr 21, 2018
2 parents 761c361 + d1cbdd3 commit 6498465
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## v1.5.3

- Bugfix for repositories without tests
- Updated extension icon

## v1.5.2

- Bugfix
Expand Down
Binary file modified icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "GitHub Pull Request Monitor",
"description": "Monitors the status of GitHub pull requests. Checks for conflicts, status reports, reviews and whether the branch is up to date.",
"icon": "icon.png",
"version": "1.5.2",
"version": "1.5.3",
"publisher": "erichbehrens",
"author": "Erich Behrens <[email protected]>",
"license": "MIT",
Expand Down
21 changes: 18 additions & 3 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,24 @@ exports.getMergeableState = (pr, reviews) => {
// https://developer.github.com/v4/reference/enum/mergeablestate/
const commit = pr.commits.nodes[0].commit.status;
const { potentialMergeCommit } = pr;
if (['MERGED', 'CLOSED'].includes(pr.state)) return pr.state;
if (pr.mergeable === 'MERGEABLE' && reviews && (commit === null /* no tests defined */ || commit.state === 'SUCCESS') && potentialMergeCommit && potentialMergeCommit.status === null) return 'MERGEABLE';
if (!reviews || commit.state === 'FAILURE' || pr.mergeable === 'CONFLICTING') return 'FAILURE';
if (['MERGED', 'CLOSED'].includes(pr.state)) {
return pr.state;
}
if (
pr.mergeable === 'MERGEABLE' &&
reviews &&
(commit === null /* no tests defined */ || commit.state === 'SUCCESS') &&
potentialMergeCommit && potentialMergeCommit.status === null
) {
return 'MERGEABLE';
}
if (
pr.mergeable === 'CONFLICTING' ||
!reviews ||
(commit !== null /* tests definied */ && commit.state === 'FAILURE')
) {
return 'FAILURE';
}
return 'OPEN';
};

Expand Down

0 comments on commit 6498465

Please sign in to comment.