Skip to content

Commit 0e2390e

Browse files
feat: include an API call example section in the pull request description
1 parent dd69dcc commit 0e2390e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.github/pull_request_template.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
77
## Related issues
88
> Issue links go here
9+
## Usage Example
10+
> Example of how to call it
911
## Checklists
1012
### Development
1113
- [ ] Lint rules pass locally

dangerfile.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import collectCoverage, { ReportType } from '@instabug/danger-plugin-coverage';
44
const hasSourceChanges = danger.git.modified_files.some((file) =>
55
file.startsWith('lib/')
66
);
7+
const hasModulesChanges = danger.git.modified_files.some((file) => file.startsWith('lib/src/modules/'));
8+
79
const declaredTrivial =
810
!hasSourceChanges ||
911
danger.github.issue.labels.some((label) => label.name === 'trivial');
@@ -14,12 +16,16 @@ async function hasDescription() {
1416
const hasNoDescription = danger.github.pr.body.includes(
1517
'> Description goes here'
1618
);
19+
const hasNoExample = danger.github.pr.body.includes('> Example of how to call it');
20+
1721
if (hasNoDescription && linesOfCode > 10) {
1822
fail(
1923
'Please provide a summary of the changes in the pull request description.'
2024
);
2125
}
22-
26+
if (hasNoExample && linesOfCode > 10 && hasModulesChanges) {
27+
warn('Please provide example of how to call it.');
28+
}
2329
if (!danger.git.modified_files.includes('CHANGELOG.md') && !declaredTrivial) {
2430
warn(
2531
'You have not included a CHANGELOG entry! \nYou can find it at [CHANGELOG.md](https://github.com/Instabug/Instabug-Flutter/blob/master/CHANGELOG.md).'

0 commit comments

Comments
 (0)