-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It is mainly a code cleanup to facilitate maintenance. Some features that did not fit well have been removed. BREAKING CHANGE: - Renamed environment variable `COMMIT_CONFIG` to `CONFIG` - Switched to stock `angular` commit-analyzer config (https://github.com/semantic-release/commit-analyzer#configuration) To restore the original behaviour, set `CONFIG`to: ``` { preset: 'angular', releaseRules: [ { type: 'chore', release: 'patch' } ], parserOpts: { noteKeywords: ['BREAKING CHANGES'] } } ``` - Dropped assignment of reviewers - Removed its own rather useless commit status
- Loading branch information
1 parent
b3e28f9
commit 9f39507
Showing
35 changed files
with
643 additions
and
948 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 |
---|---|---|
@@ -1,28 +1,21 @@ | ||
'use strict' | ||
|
||
const handleCheck = require('./lib/handleCheck') | ||
const handleCommitStatus = require('./lib/handleCommitStatus') | ||
const handleComment = require('./lib/handleComment') | ||
const handlePullRequestChange = require('./lib/handlePullRequestChange') | ||
const status = require('./lib/handlers/status') | ||
const comment = require('./lib/handlers/comment') | ||
const pullRequestChange = require('./lib/handlers/pullRequestChange') | ||
|
||
const probotPlugin = (robot) => { | ||
robot.on([ | ||
'pull_request.edited', | ||
'pull_request.labeled', | ||
'pull_request.unlabeled', | ||
'pull_request.opened', | ||
'pull_request.reopened' | ||
], handlePullRequestChange) | ||
], pullRequestChange) | ||
robot.on([ | ||
'issue_comment.created' | ||
], handleComment) | ||
robot.on([ | ||
'check_run.completed', | ||
'check_suite.completed' | ||
], handleCheck) | ||
], comment) | ||
robot.on([ | ||
'status' | ||
], handleCommitStatus) | ||
], status) | ||
} | ||
|
||
module.exports = probotPlugin |
This file was deleted.
Oops, something went wrong.
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,69 @@ | ||
'use strict' | ||
|
||
const debug = require('debug')('app:buildResultMessage') | ||
|
||
const getMergeComment = require('./merge/getMergeComment') | ||
const getReleaseType = require('./getReleaseType') | ||
|
||
const getSuccessMessage = async function ({ commitMessage }) { | ||
debug('composeSuccessMessage') | ||
|
||
const releaseType = await getReleaseType(commitMessage.full) | ||
const successComment = releaseType ? [ | ||
'🎉 Pull Request Merged 🎉', | ||
'', | ||
'This pull request has been merged with the following commit message:', | ||
'', | ||
'``````', | ||
commitMessage.full, | ||
'``````', | ||
'', | ||
`A **${releaseType}** release is triggered.` | ||
] : [ | ||
'🎉 Pull Request Merged 🎉', | ||
'', | ||
'No type of pull request detected. Therefore, no release is triggered.' | ||
] | ||
|
||
return successComment.join('\n') | ||
} | ||
|
||
const getErrorMessage = async function ({ context, exception }) { | ||
debug('composeErrorMessage') | ||
|
||
let errorMessage | ||
try { | ||
errorMessage = JSON.parse(exception.message).message | ||
} catch (exJson) { | ||
errorMessage = exception.message | ||
} | ||
|
||
const comment = await getMergeComment(context) | ||
let deleteNote | ||
if (comment) { | ||
deleteNote = `Delete the [/merge comment](${comment.html_url}) to stop.` | ||
} | ||
|
||
return [ | ||
'⚠️ Merging Pull Request Failed ⚠️', | ||
'', | ||
errorMessage, | ||
'', | ||
`Merge will be **automatically retried** on any change. ${deleteNote}` | ||
].join('\n') | ||
} | ||
|
||
const buildResultMessage = async function ({ context, exception = null, commitMessage = null }) { | ||
debug('Start') | ||
|
||
let message = '' | ||
if (exception) { | ||
message = await getErrorMessage({ context, exception }) | ||
} else { | ||
message = await getSuccessMessage({ context, commitMessage }) | ||
} | ||
|
||
return message | ||
} | ||
|
||
module.exports = buildResultMessage |
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,7 @@ | ||
'use strict' | ||
|
||
const getenv = require('getenv') | ||
|
||
const config = JSON.parse(getenv('CONFIG', '{ "preset": "angular" }')) | ||
|
||
module.exports = config |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.