From cf618887179a23d1c9f3419d25825555a3e1795e Mon Sep 17 00:00:00 2001 From: fvanderflier Date: Mon, 29 Dec 2025 16:19:26 +0100 Subject: [PATCH 1/4] feat: Add markdown template for PRs --- .github/pull_request_template.md | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..9e1d033 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,49 @@ +## What Changed? + + + +## Why? + + + +Fixes #(issue number) + +## Type of Change + + + +- [ ] 🐛 Bug fix (fixes an issue without breaking existing functionality) +- [ ] ✨ New feature (adds new functionality without breaking existing features) +- [ ] 💥 Breaking change (existing functionality will be affected) +- [ ] 📝 Documentation update +- [ ] 🔧 Maintenance (refactoring, dependencies, configuration) + +## How Did You Test This? + + + +**What I tested:** + +- [ ] +- [ ] + +**How to test it:** + + + +1. +2. + +## Review Checklist + + + +- [ ] My code follows the project's style and conventions +- [ ] I've reviewed my own code for obvious issues +- [ ] I've added comments where the code might be confusing +- [ ] I've updated relevant documentation (if needed) +- [ ] I've tested my changes and they work as expected + +## Screenshots / Additional Context + + From 08f46805fc199f89f2475d6c814001c524a22e1f Mon Sep 17 00:00:00 2001 From: fvanderflier Date: Mon, 29 Dec 2025 16:35:30 +0100 Subject: [PATCH 2/4] fix template and add pr-template check --- .github/pull_request_template.md | 31 +++++----- .github/workflows/pr-template-check.yml | 75 +++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/pr-template-check.yml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 9e1d033..288fe9f 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,16 +1,16 @@ ## What Changed? +*Provide a clear summary of your changes. What did you add, remove, or modify?* - -## Why? - +## Why? +*Explain why these changes were needed. What problem does this solve? Link any related issues.* Fixes #(issue number) -## Type of Change - +## Type of Change +*Check the box that applies by putting an 'x' inside the brackets: [x]* - [ ] 🐛 Bug fix (fixes an issue without breaking existing functionality) - [ ] ✨ New feature (adds new functionality without breaking existing features) @@ -19,31 +19,26 @@ Fixes #(issue number) - [ ] 🔧 Maintenance (refactoring, dependencies, configuration) ## How Did You Test This? - - +*Describe what you did to verify your changes work correctly. This helps reviewers understand how to test your PR.* **What I tested:** - -- [ ] -- [ ] +- [ ] +- [ ] **How to test it:** - - - -1. -2. +*Optional: Add steps for reviewers to reproduce your testing* +1. +2. ## Review Checklist - [ ] My code follows the project's style and conventions -- [ ] I've reviewed my own code for obvious issues -- [ ] I've added comments where the code might be confusing +*Quick self-check before submitting. You don't need to check every box, but consider each item.* - [ ] I've updated relevant documentation (if needed) - [ ] I've tested my changes and they work as expected ## Screenshots / Additional Context - +*Optional: Add screenshots, logs, or any other helpful information for reviewers* \ No newline at end of file diff --git a/.github/workflows/pr-template-check.yml b/.github/workflows/pr-template-check.yml new file mode 100644 index 0000000..772233a --- /dev/null +++ b/.github/workflows/pr-template-check.yml @@ -0,0 +1,75 @@ +name: PR Template Check + +on: + pull_request: + types: [opened, edited, synchronize] + +jobs: + check-pr-description: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Check if PR description is filled out + uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + const prBody = context.payload.pull_request.body || ''; + + // Read the template file + const templatePath = '.github/pull_request_template.md'; + let template = ''; + try { + template = fs.readFileSync(templatePath, 'utf8'); + } catch (error) { + console.log('⚠️ Could not read template file, skipping template comparison'); + return; + } + + // Normalize whitespace for comparison + const normalizeText = (text) => text.replace(/\s+/g, ' ').trim(); + const normalizedPrBody = normalizeText(prBody); + const normalizedTemplate = normalizeText(template); + + // Check if PR body is identical to template + if (normalizedPrBody === normalizedTemplate) { + core.setFailed('❌ PR description is identical to the template. Please fill out the template with information about your changes.'); + return; + } + + // Check if PR body is empty or only contains whitespace + if (prBody.trim().length === 0) { + core.setFailed('❌ PR description is empty. Please fill out the template with information about your changes.'); + return; + } + + // Keywords that indicate the template hasn't been filled out + const templateKeywords = [ + 'Provide a clear summary of your changes', + 'What did you add, remove, or modify?', + 'Explain why these changes were needed', + 'Fixes #(issue number)', + ]; + + // Check if template keywords are still present (indicating it wasn't filled out) + const foundKeywords = templateKeywords.filter(keyword => + prBody.includes(keyword) + ); + + if (foundKeywords.length >= 2) { + core.setFailed( + `❌ PR template appears to be unfilled. Please replace the template text with your actual changes.\n\n` + + `Found unchanged template text:\n${foundKeywords.map(k => ` - "${k}"`).join('\n')}` + ); + return; + } + + // Check if "Fixes #(issue number)" is still present unchanged + if (prBody.includes('Fixes #(issue number)')) { + core.setFailed('❌ Please update "Fixes #(issue number)" with an actual issue number or remove it if not applicable.'); + return; + } + + console.log('✅ PR description appears to be properly filled out!'); From 56a38bc802559b610bde516210e0535ea5614dd7 Mon Sep 17 00:00:00 2001 From: fvanderflier Date: Fri, 2 Jan 2026 14:41:39 +0100 Subject: [PATCH 3/4] change back to comment hints --- .github/pull_request_template.md | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 288fe9f..a6b9189 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,16 +1,16 @@ ## What Changed? -*Provide a clear summary of your changes. What did you add, remove, or modify?* - + ## Why? -*Explain why these changes were needed. What problem does this solve? Link any related issues.* -Fixes #(issue number) + +Fixes #(issue number) ## Type of Change -*Check the box that applies by putting an 'x' inside the brackets: [x]* + + - [ ] 🐛 Bug fix (fixes an issue without breaking existing functionality) - [ ] ✨ New feature (adds new functionality without breaking existing features) @@ -19,26 +19,31 @@ Fixes #(issue number) - [ ] 🔧 Maintenance (refactoring, dependencies, configuration) ## How Did You Test This? -*Describe what you did to verify your changes work correctly. This helps reviewers understand how to test your PR.* + + **What I tested:** -- [ ] -- [ ] + +- [ ] +- [ ] **How to test it:** -*Optional: Add steps for reviewers to reproduce your testing* -1. -2. + + + +1. +2. ## Review Checklist - [ ] My code follows the project's style and conventions -*Quick self-check before submitting. You don't need to check every box, but consider each item.* +- [ ] I've reviewed my own code for obvious issues +- [ ] I've added comments where the code might be confusing - [ ] I've updated relevant documentation (if needed) - [ ] I've tested my changes and they work as expected ## Screenshots / Additional Context -*Optional: Add screenshots, logs, or any other helpful information for reviewers* \ No newline at end of file + From 933bd4500aea3936a7fc7b0fea1b9a1c7333bd63 Mon Sep 17 00:00:00 2001 From: Filip van der Flier Chejkovski Date: Wed, 14 Jan 2026 22:16:40 +0100 Subject: [PATCH 4/4] Update pull request template to use 'Closes' keyword --- .github/pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index a6b9189..1dd8aea 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -6,7 +6,7 @@ -Fixes #(issue number) +Closes #(issue number) ## Type of Change