Skip to content

feat: add supported extensions in appsettings #315

feat: add supported extensions in appsettings

feat: add supported extensions in appsettings #315

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;
}
if (prBody.includes('Closes #(issue number)')) {
core.setFailed('❌ Please update "Closes #(issue number)" with an actual issue number or remove it if not applicable.');
return;
}
console.log('✅ PR description appears to be properly filled out!');