Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/actions/validate-pr-description/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "Validate PR Description"
description: "Validates that the pull request description follows the pull request template."

runs:
using: "composite"
steps:
- name: Init action
shell: bash
run: |
set -euo pipefail
echo "TEMPLATE_PATH=.github/pull_request_template.md" >> "$GITHUB_ENV"

- name: Check if PR has a description
shell: bash
run: |
set -euo pipefail

PR_BODY=$(jq --raw-output ".pull_request.body // empty" "$GITHUB_EVENT_PATH")

if [ -z "$PR_BODY" ]; then
echo "ERROR: PR description is missing."
exit 1
fi

printf '%s' "$PR_BODY" > pr_body.txt

- name: Compare PR body to template
shell: bash
run: |
set -euo pipefail

if [ ! -f "$TEMPLATE_PATH" ]; then
echo "WARNING: Default PR template not found at $TEMPLATE_PATH, skipping comparison."
exit 0
fi

PR_BODY_CLEAN=$(mktemp)
TEMPLATE_CLEAN=$(mktemp)

sed '/^[[:space:]]*$/d' pr_body.txt | sed 's/[[:space:]]//g' > "$PR_BODY_CLEAN"
sed '/^[[:space:]]*$/d' "$TEMPLATE_PATH" | sed 's/[[:space:]]//g' > "$TEMPLATE_CLEAN"

if cmp -s "$PR_BODY_CLEAN" "$TEMPLATE_CLEAN"; then
echo "ERROR: PR description matches the template too closely. Please provide a meaningful description."
exit 1
else
echo "PR description differs sufficiently from the template."
fi

- name: Ensure all checkboxes are checked
uses: mheap/require-checklist-action@v2
18 changes: 18 additions & 0 deletions .github/actions/validate-pr-title/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: "Validate PR Title"
description: "Validates the pull request title according to the Conventional Commits specification."

permissions:
pull-requests: read

inputs:
github-token:
description: GitHub token to read PR data
required: true

runs:
using: "composite"
steps:
- name: Validate PR title
uses: amannn/action-semantic-pull-request@v6
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
27 changes: 27 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Change Description

Provide a brief description of the change being introduced.

## Changes Made

- List the key changes or enhancements introduced in this pull request.

## Testing Instructions for QA Team

_Describe how to test the change as if you were a new team member._

- _Example:_
- Use Postman to test the API
- Run integration tests
- Perform manual testing in the browser

## Checklist

- [ ] The pull request is linked to the corresponding GitHub issue.
- [ ] The developer confirms that this pull request has been verified against the [Pull Request Checklist](https://github.com/minvws/nl-mgo-coordination-private/blob/develop/backend/pull-request-checklist.md).
- [ ] I've read the [contributing document](https://github.com/minvws/.github/blob/main/CONTRIBUTING.md)
- [ ] I've read and understand the [Code of Conduct](https://github.com/minvws/.github/blob/main/CODE_OF_CONDUCT.md)
- [ ] I've signed off all commits in this pull request in accordance with the [Developer Certificate of Origin (DCO)](https://github.com/minvws/.github/blob/main/DCO.txt)

> [!TIP]
> If you're not signing your commits with a GPG key, you can use `git commit -s` to add the required `Signed-off-by:` line to each commit.
26 changes: 26 additions & 0 deletions .github/workflows/validate-pr-meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Validate PR Meta
description: Validates the title and description of the pull request.

on:
pull_request:
types: [opened, reopened, ready_for_review, edited, synchronize]

jobs:
pr-meta-validation:
runs-on: ubuntu-latest
name: Validate PR Meta
if: github.event.pull_request.draft == false
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
sparse-checkout: |
.github

- name: Validate PR Title (Conventional Commits)
uses: ./.github/actions/validate-pr-title
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Validate PR Description (Template)
uses: ./.github/actions/validate-pr-description
Loading