Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8512872
commit aec6d86
Showing
12 changed files
with
194 additions
and
75 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use strict'; | ||
|
||
exports.autoAssignPRToCreator = (repoContext, context) => { | ||
if (!repoContext.config.autoAssignToCreator) return; | ||
|
||
const pr = context.payload.pull_request; | ||
if (pr.assignees.length !== 0) return; | ||
|
||
return context.github.issues.addAssignees( | ||
context.issue({ | ||
assignees: [pr.user.login], | ||
}) | ||
); | ||
}; |
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,19 @@ | ||
'use strict'; | ||
|
||
const cleanTitle = require('../utils/cleanTitle'); | ||
|
||
exports.editOpenedPR = (repoContext, context) => { | ||
if (!repoContext.config.trimTitle) return; | ||
|
||
const pr = context.payload.pull_request; | ||
const title = cleanTitle(pr.title); | ||
|
||
if (pr.title !== title) { | ||
pr.title = title; | ||
context.github.issues.update( | ||
context.issue({ | ||
title, | ||
}) | ||
); | ||
} | ||
}; |
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,34 @@ | ||
'use strict'; | ||
|
||
exports.lintPR = (repoContext, context) => { | ||
if (!repoContext.config.prLint) return; | ||
|
||
const repo = context.payload.repository; | ||
const pr = context.payload.pull_request; | ||
|
||
// do not lint pr from forks | ||
if (pr.head.repo.id !== repo.id) return; | ||
|
||
const errorRule = repoContext.config.prLint.title.find( | ||
(rule) => !rule.regExp.test(pr.title) | ||
); | ||
|
||
const date = new Date(); | ||
|
||
return context.github.checks.create( | ||
context.repo({ | ||
name: 'reviewflow/lint-pr', | ||
head_sha: pr.head.sha, | ||
status: 'completed', | ||
conclusion: errorRule ? 'failure' : 'success', | ||
started_at: date, | ||
completed_at: date, | ||
output: errorRule | ||
? errorRule.error | ||
: { | ||
title: '✓ Your PR is valid', | ||
summary: '', | ||
}, | ||
}) | ||
); | ||
}; |
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
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,67 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
autoAssignToCreator: true, | ||
trimTitle: true, | ||
prLint: { | ||
title: [ | ||
{ | ||
regExp: | ||
// eslint-disable-next-line unicorn/no-unsafe-regex | ||
/^(revert: )?(build|chore|ci|docs|feat|fix|perf|refactor|style|test)(\(([a-z\-/]*)\))?:\s/, | ||
error: { | ||
title: 'Title does not match commitlint conventional', | ||
summary: | ||
'https://github.com/marionebl/commitlint/tree/master/%40commitlint/config-conventional', | ||
}, | ||
}, | ||
], | ||
}, | ||
dev: { | ||
christophehurpeau: 'christophe@hurpeau.com', | ||
}, | ||
waitForGroups: { | ||
dev: [], | ||
design: ['devs'], | ||
}, | ||
labels: { | ||
list: { | ||
// /* ci */ | ||
// 'ci/in-progress': { name: ':green_heart: ci/in-progress', color: '#0052cc' }, | ||
// 'ci/fail': { name: ':green_heart: ci/fail', color: '#e11d21' }, | ||
// 'ci/passed': { name: ':green_heart: ci/passed', color: '#86f9b4' }, | ||
|
||
/* code */ | ||
'code/needs-review': { | ||
name: ':ok_hand: code/needs-review', | ||
color: '#FFD57F', | ||
}, | ||
'code/review-requested': { | ||
name: ':ok_hand: code/review-requested', | ||
color: '#B2E1FF', | ||
}, | ||
'code/changes-requested': { | ||
name: ':ok_hand: code/changes-requested', | ||
color: '#e11d21', | ||
}, | ||
'code/approved': { | ||
name: ':ok_hand: code/approved', | ||
color: '#64DD17', | ||
}, | ||
}, | ||
|
||
review: { | ||
ci: { | ||
inProgress: 'ci/in-progress', | ||
succeeded: 'ci/success', | ||
failed: 'ci/fail', | ||
}, | ||
dev: { | ||
needsReview: 'code/needs-review', | ||
requested: 'code/review-requested', | ||
changesRequested: 'code/changes-requested', | ||
approved: 'code/approved', | ||
}, | ||
}, | ||
}, | ||
}; |
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,4 @@ | ||
'use strict'; | ||
|
||
exports.ornikar = require('./ornikar'); | ||
exports.christophehurpeau = require('./christophehurpeau'); |
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
Oops, something went wrong.