forked from dcoapp/app
-
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.
Merge pull request dcoapp#14 from probot/ignore-merges
Avoid checking for sign off on merges add env to gitignore Signed-off-by: Bex Warner <hiimbex@github.com> update to use current probot version and standards Signed-off-by: Bex Warner <hiimbex@github.com> Added error handling and update tests Signed-off-by: Bex Warner <hiimbex@github.com> fix logic Signed-off-by: Bex Warner <hiimbex@github.com> fix test Signed-off-by: Bex Warner <hiimbex@github.com> refactor to use regex Signed-off-by: Bex Warner <hiimbex@github.com> update tests for regex Signed-off-by: Bex Warner <hiimbex@github.com> target_url = probot/doc/#how-it-works Signed-off-by: Bex Warner <hiimbex@github.com>
- Loading branch information
Showing
8 changed files
with
4,674 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# The ID of your GitHub integration | ||
INTEGRATION_ID= | ||
# The ID of your GitHub App | ||
APP_ID= | ||
WEBHOOK_SECRET=development |
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,3 +1,4 @@ | ||
node_modules | ||
npm-debug.log | ||
private-key.pem | ||
.env |
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,4 +1,21 @@ | ||
module.exports = commit => { | ||
const signOff = `Signed-off-by: ${commit.author.name} <${commit.author.email}>`; | ||
return commit.message.includes(signOff); | ||
module.exports = ({commit, parents}) => { | ||
const isMerge = parents && parents.length > 1; | ||
const expectedSignOff = `Signed-off-by: ${commit.author.name} <${commit.author.email}>`; | ||
const regex = /^Signed-off-by: (.*) <(.*)>$/m; | ||
let match; | ||
|
||
if (isMerge) { | ||
return true; | ||
} else if ((match = regex.exec(commit.message)) === null) { | ||
return 'The sign-off is missing. '; | ||
} else { | ||
match = regex.exec(commit.message); | ||
if (match[0] === expectedSignOff) { | ||
return true; | ||
} else if (!match[0].includes(`Signed-off-by:`)) { | ||
return 'The sign-off is missing. '; | ||
} else if (commit.author.name !== match[1] || commit.author.email !== match[2]) { | ||
return `Expected "${commit.author.name} <${commit.author.email}>", but got "${match[1]} <${match[2]}>" `; | ||
} | ||
} | ||
}; |
Oops, something went wrong.