From 1920e3e1fd1f73170f6987b68151a9ecf3356a9d Mon Sep 17 00:00:00 2001 From: Ahmed alaa Date: Tue, 15 Jul 2025 17:20:00 +0300 Subject: [PATCH 1/2] feat: Include an API call example section in the pull request description --- .github/pull_request_template.md | 4 ++++ dangerfile.ts | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index aba9581b7..1ca7ca42c 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -12,6 +12,10 @@ > Issue links go here +## Usage Example + +> Example of how to call it + ## Checklists ### Development diff --git a/dangerfile.ts b/dangerfile.ts index 2a2e5ec59..419dfef67 100644 --- a/dangerfile.ts +++ b/dangerfile.ts @@ -2,17 +2,23 @@ import collectCoverage, { ReportType } from '@instabug/danger-plugin-coverage'; import { danger, fail, schedule, warn } from 'danger'; const hasSourceChanges = danger.git.modified_files.some((file) => file.startsWith('src/')); +const hasModulesChanges = danger.git.modified_files.some((file) => file.startsWith('src/modules/')); const declaredTrivial = !hasSourceChanges || danger.github.issue.labels.some((label) => label.name === 'trivial'); -// Make sure PR has a description. +// Make sure PR has a description and ca;;ing example. async function hasDescription() { const linesOfCode = (await danger.git.linesOfCode()) ?? 0; const hasNoDiscription = danger.github.pr.body.includes('> Description goes here'); + const hasNoExample = danger.github.pr.body.includes('> Example of how to call it'); if (hasNoDiscription && linesOfCode > 10) { fail('Please provide a summary of the changes in the pull request description.'); } + if (hasNoExample && linesOfCode > 10 && hasModulesChanges) { + warn('Please provide example of how to call it.'); + } + if (!danger.git.modified_files.includes('CHANGELOG.md') && !declaredTrivial) { warn( 'You have not included a CHANGELOG entry! \nYou can find it at [CHANGELOG.md](https://github.com/Instabug/Instabug-React-Native/blob/master/CHANGELOG.md).', From 56689ff0dfcb214e1f4d47b8347dbee5ebd5d733 Mon Sep 17 00:00:00 2001 From: Andrew Amin <160974398+AndrewAminInstabug@users.noreply.github.com> Date: Tue, 22 Jul 2025 10:12:55 +0300 Subject: [PATCH 2/2] Update dangerfile.ts --- dangerfile.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dangerfile.ts b/dangerfile.ts index 419dfef67..d9c7672fe 100644 --- a/dangerfile.ts +++ b/dangerfile.ts @@ -6,7 +6,7 @@ const hasModulesChanges = danger.git.modified_files.some((file) => file.startsWi const declaredTrivial = !hasSourceChanges || danger.github.issue.labels.some((label) => label.name === 'trivial'); -// Make sure PR has a description and ca;;ing example. +// Make sure PR has a description and calling example. async function hasDescription() { const linesOfCode = (await danger.git.linesOfCode()) ?? 0; const hasNoDiscription = danger.github.pr.body.includes('> Description goes here');