Skip to content

Automated PR template enforcement via GitHub Actions #62

Description

@anshul23102

Feature Request

Is your feature request related to a problem?

PRs submitted to Oss-Dev projects often lack required information (linked issue, description of changes, testing steps). Reviewers must chase contributors for this information, slowing down review cycles.

Describe the solution you'd like

Create a GitHub Actions workflow that validates PRs against the repository's PULL_REQUEST_TEMPLATE.md. The action checks that required sections are not left blank or contain only the template placeholder text.

# .github/workflows/pr-lint.yml
name: PR Template Check
on:
  pull_request:
    types: [opened, edited, synchronize]

jobs:
  lint-pr:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Validate PR body
        uses: actions/github-script@v7
        with:
          script: |
            const body = context.payload.pull_request.body ?? '';
            const required = ['## Description', '## Related Issue', '## How to Test'];
            const missing = required.filter(s => !body.includes(s));
            if (missing.length) {
              core.setFailed(`PR is missing required sections: ${missing.join(', ')}`);
            }

Post an automated comment listing missing sections so the author knows exactly what to fix.

Describe alternatives you've considered

  • Reviewer manually requests changes (inconsistent, adds review overhead)
  • No enforcement (current state; template is ignored frequently)

Additional context

Level 3 feature. The required sections list should be configurable via a .github/pr-lint-config.json file so individual repos can customize without changing the workflow.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions