-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[New] add
--commit
to check status of commits instead of just PRs
- Loading branch information
1 parent
3a6fa74
commit 848a8db
Showing
6 changed files
with
131 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict'; | ||
|
||
const commitStatus = require('./models/commitStatus'); | ||
|
||
const success = (commit) => commit?.statusCheckRollup?.state === 'SUCCESS'; | ||
const failure = (commit) => commit?.statusCheckRollup?.state === 'ERROR' || commit?.statusCheckRollup?.state === 'FAILURE'; | ||
const pending = (commit) => commit?.statusCheckRollup?.state === 'PENDING'; | ||
|
||
module.exports = function evaluateCommitStatus(commit) { | ||
if (success(commit)) { | ||
return commitStatus.STATUS_SUCCESS; | ||
} | ||
if (failure(commit)) { | ||
return commitStatus.STATUS_FAILURE; | ||
} | ||
if (pending(commit)) { | ||
return commitStatus.STATUS_PENDING; | ||
} | ||
return commitStatus.STATUS_NOT_FOUND; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
STATUS_FAILURE: '⚠ Some commit checks were not successful', | ||
STATUS_NOT_FOUND: 'ℹ No commit checks were found', | ||
STATUS_PENDING: '⌛ Some commit checks are pending', | ||
STATUS_SUCCESS: '✔ All commit checks are successful', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters