Skip to content

Ci/pr template validation#14

Merged
imuniqueshiv merged 4 commits into
mainfrom
ci/pr-template-validation
Jun 27, 2026
Merged

Ci/pr template validation#14
imuniqueshiv merged 4 commits into
mainfrom
ci/pr-template-validation

Conversation

@imuniqueshiv

@imuniqueshiv imuniqueshiv commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Summary

Add automated validation for Pull Request templates to ensure contributors provide complete and meaningful PR descriptions before review.


Related Issue

N/A


Type of Change

  • Feature
  • Bug Fix
  • Documentation
  • Refactor
  • Performance Improvement
  • CI / Build
  • Other

What Changed?

  • Added a GitHub Actions workflow to validate Pull Request descriptions.
  • Prevents placeholder template text from being submitted.
  • Ensures contributors select at least one change type.
  • Ensures required sections of the PR template are completed.
  • Issue numbers remain optional for maintainers and collaborators.

Testing

  • Verified the workflow syntax.
  • Opened a test Pull Request to confirm the validation executes correctly.

Checklist

  • My branch is up to date with the latest main.
  • My code follows the project's coding standards.
  • I have formatted the modified files.
  • npm run format:check passes.
  • npm run lint passes.
  • npm run typecheck passes.
  • npm run build passes.
  • Documentation has been updated if required.
  • I have tested my changes locally.
  • This Pull Request focuses on a single feature.

Additional Notes

This workflow improves contribution quality by enforcing a consistent Pull Request template while keeping issue references optional.

Summary by CodeRabbit

  • Chores
    • Added validation for pull request descriptions to help ensure submissions are complete and follow the required template.
    • PRs now need at least one change type and one completed checklist item before they can pass validation.

@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hyper-learning-tech Ready Ready Preview, Comment Jun 27, 2026 8:12am

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a GitHub Actions workflow that runs on pull request events and validates the PR body. It fails when the description is empty, still contains placeholder text, lacks a checked type-of-change item, or has no checked checklist items.

Changes

PR template validation

Layer / File(s) Summary
Workflow validation
.github/workflows/pr-template-validation.yml
Adds the pull request-triggered workflow and a validation script that checks the PR body for required content, checked type-of-change options, and checked checklist items.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Hop, hop—your PR is bright,
Templates checked and filled just right.
No placeholder crumbs remain to see,
Just tidy boxes and harmony.
The workflow wiggles: all clear tonight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately points to the new CI workflow for PR template validation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/pr-template-validation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/pr-template-validation.yml:
- Around line 64-69: The checklist validation in the PR template workflow is too
broad because the checked-box regex is matching any checkbox in the body,
including the required Type of Change section. Update the logic in the
workflow’s checklist check so it only scans the content under the ## Checklist
section before evaluating for at least one checked item, using the existing
validation block that sets checkedChecklist and errors.push. This should prevent
non-checklist selections from satisfying the requirement.
- Line 20: The workflow step using actions/github-script is not pinned to an
immutable revision, so update the uses reference in the GitHub Actions workflow
to a full commit SHA instead of `@v7`. Locate the github-script step in the
validation workflow and replace the version tag with the exact trusted commit
for actions/github-script.
- Around line 36-48: The PR template validation in the workflow only checks for
exact placeholder strings, so empty required sections can still pass. Update the
validation logic around the placeholder checks to also verify that the required
sections in the template such as Summary, What Changed?, and Testing contain
real user content, not just headings, separators, or stub bullets. Use the
existing validation flow in the workflow script to add section-level emptiness
checks alongside the current contains(placeholder) logic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 38853f6e-c9ab-4728-a991-3a1409fc2ddb

📥 Commits

Reviewing files that changed from the base of the PR and between 1285150 and 1563c14.

📒 Files selected for processing (1)
  • .github/workflows/pr-template-validation.yml


steps:
- name: Validate Pull Request Template
uses: actions/github-script@v7

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== workflow ==\n'
cat -n .github/workflows/pr-template-validation.yml

printf '\n== pr template ==\n'
cat -n .github/PULL_REQUEST_TEMPLATE.md

printf '\n== pinning references ==\n'
rg -n "github-script@v7|pin.*SHA|full commit SHA|zizmor|actions/" .github README.md . || true

Repository: imuniqueshiv/HyperLearningTech

Length of output: 5070


Pin actions/github-script to a full commit SHA. Using @v7 leaves this guardrail exposed to upstream changes; pin the exact revision you intend to trust.

🧰 Tools
🪛 zizmor (1.26.1)

[error] 20-20: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/pr-template-validation.yml at line 20, The workflow step
using actions/github-script is not pinned to an immutable revision, so update
the uses reference in the GitHub Actions workflow to a full commit SHA instead
of `@v7`. Locate the github-script step in the validation workflow and replace the
version tag with the exact trusted commit for actions/github-script.

Source: Linters/SAST tools

Comment on lines +36 to +48
// Placeholder text must be removed
const placeholders = [
"Provide a brief description of your changes.",
"Briefly describe the key changes made in this Pull Request.",
"Describe how you tested your changes.",
"Add any additional context for reviewers if needed."
];

for (const placeholder of placeholders) {
if (contains(placeholder)) {
errors.push(`Remove placeholder text: "${placeholder}"`);
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

This still allows empty required sections.

Right now the workflow only rejects the exact placeholder sentences. In the template, ## Summary, ## What Changed?, and ## Testing can still be left effectively blank by removing the placeholder text and keeping only the stub bullets/separators, so the “required sections are filled out” objective is not actually enforced.

Suggested direction
+            function getSection(title) {
+              return (
+                body.match(new RegExp(`## ${title}\\s*([\\s\\S]*?)(?:\\n---|\\n## |$)`, "i"))?.[1] ?? ""
+              );
+            }
+
+            function hasMeaningfulContent(text) {
+              return text
+                .replace(/^\s*-\s*$/gm, "")
+                .replace(/^\s*\*\*\*\s*$/gm, "")
+                .trim().length > 0;
+            }
+
+            for (const section of ["Summary", "What Changed\\?", "Testing"]) {
+              if (!hasMeaningfulContent(getSection(section))) {
+                errors.push(`Fill out the '${section.replace("\\?", "?")}' section.`);
+              }
+            }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Placeholder text must be removed
const placeholders = [
"Provide a brief description of your changes.",
"Briefly describe the key changes made in this Pull Request.",
"Describe how you tested your changes.",
"Add any additional context for reviewers if needed."
];
for (const placeholder of placeholders) {
if (contains(placeholder)) {
errors.push(`Remove placeholder text: "${placeholder}"`);
}
}
// Placeholder text must be removed
const placeholders = [
"Provide a brief description of your changes.",
"Briefly describe the key changes made in this Pull Request.",
"Describe how you tested your changes.",
"Add any additional context for reviewers if needed."
];
for (const placeholder of placeholders) {
if (contains(placeholder)) {
errors.push(`Remove placeholder text: "${placeholder}"`);
}
}
function getSection(title) {
return (
body.match(new RegExp(`## ${title}\\s*([\\s\\S]*?)(?:\\n---|\\n## |$)`, "i"))?.[1] ?? ""
);
}
function hasMeaningfulContent(text) {
return text
.replace(/^\s*-\s*$/gm, "")
.replace(/^\s*\*\*\*\s*$/gm, "")
.trim().length > 0;
}
for (const section of ["Summary", "What Changed\\?", "Testing"]) {
if (!hasMeaningfulContent(getSection(section))) {
errors.push(`Fill out the '${section.replace("\\?", "?")}' section.`);
}
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/pr-template-validation.yml around lines 36 - 48, The PR
template validation in the workflow only checks for exact placeholder strings,
so empty required sections can still pass. Update the validation logic around
the placeholder checks to also verify that the required sections in the template
such as Summary, What Changed?, and Testing contain real user content, not just
headings, separators, or stub bullets. Use the existing validation flow in the
workflow script to add section-level emptiness checks alongside the current
contains(placeholder) logic.

Comment on lines +64 to +69
// Require at least one checklist item to be checked
const checkedChecklist =
/\- \[x\]/i.test(body);

if (!checkedChecklist) {
errors.push("Complete the checklist before requesting review.");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Restrict the checklist regex to the ## Checklist section.

/\- \[x\]/i matches any checked box in the PR body, including the required Type of Change selection from .github/PULL_REQUEST_TEMPLATE.md. That means a PR with zero checklist items checked still passes once one change type is selected.

Suggested fix
-            const checkedChecklist =
-              /\- \[x\]/i.test(body);
+            const checklistSection =
+              body.match(/## Checklist\s*([\s\S]*?)(?:\n---|\n## |\s*$)/i)?.[1] ?? "";
+            const checkedChecklist = /\- \[x\]/i.test(checklistSection);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Require at least one checklist item to be checked
const checkedChecklist =
/\- \[x\]/i.test(body);
if (!checkedChecklist) {
errors.push("Complete the checklist before requesting review.");
const checklistSection =
body.match(/## Checklist\s*([\s\S]*?)(?:\n---|\n## |\s*$)/i)?.[1] ?? "";
const checkedChecklist = /\- \[x\]/i.test(checklistSection);
if (!checkedChecklist) {
errors.push("Complete the checklist before requesting review.");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/pr-template-validation.yml around lines 64 - 69, The
checklist validation in the PR template workflow is too broad because the
checked-box regex is matching any checkbox in the body, including the required
Type of Change section. Update the logic in the workflow’s checklist check so it
only scans the content under the ## Checklist section before evaluating for at
least one checked item, using the existing validation block that sets
checkedChecklist and errors.push. This should prevent non-checklist selections
from satisfying the requirement.

@imuniqueshiv imuniqueshiv merged commit 0b2c147 into main Jun 27, 2026
4 checks passed
@github-actions

Copy link
Copy Markdown

🎉 Congratulations @imuniqueshiv!

Thank you for contributing to HyperLearningTech.

Your pull request has been successfully merged into main.

📦 Merge Summary

🚀 Keep Contributing

  • Follow the CONTRIBUTING.md guidelines.
  • Keep each Pull Request focused on a single feature or fix.
  • Run formatting, linting, type checking, and a production build before opening a PR.

Thank you for helping make HyperLearningTech better.

Happy Coding! 🚀

@imuniqueshiv imuniqueshiv deleted the ci/pr-template-validation branch June 27, 2026 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant