mirror of
https://github.com/Xevion/linkpulse.git
synced 2025-12-09 12:07:53 -06:00
60 lines
2.0 KiB
YAML
60 lines
2.0 KiB
YAML
name: Checklist
|
|
|
|
on: [pull_request]
|
|
|
|
jobs:
|
|
changelog:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
const fs = require('fs');
|
|
const path = 'CHANGELOG.md';
|
|
const changelog = fs.readFileSync(path, 'utf8');
|
|
const errors = [];
|
|
|
|
// Check each line that starts with '##' for the version & date format
|
|
changelog.split('\n').forEach((line, index) => {
|
|
index += 1;
|
|
|
|
if (!line.startsWith('## '))
|
|
return;
|
|
|
|
if (line.toLowerCase().includes('unreleased')) {
|
|
const message = `Unreleased section found at line ${index}: ${line}`;
|
|
const command = `::error file=${path},line=${index},endLine=${index},title=Unreleased Section Found::${message}`;
|
|
console.log(command);
|
|
errors.push(message);
|
|
}
|
|
|
|
// Expected format: '## [X.Y.Z] - YYYY-MM-DD'
|
|
const pattern = /^\d+\.\d+\.\d+ - \d{4}-\d{2}-\d{2}$/;
|
|
if (pattern.test(line)) {
|
|
const message = `Invalid version/date format at line ${index}: ${line}`;
|
|
const command = `::error file=${path},line=${index},endLine=${index},title=Invalid Version/Date Format::${message}`;
|
|
console.log(command);
|
|
errors.push(message);
|
|
}
|
|
});
|
|
|
|
if (errors.length > 0) {
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
|
|
draft:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
const forbiddenLabels = ['draft'];
|
|
let labels = context.payload.pull_request.labels;
|
|
|
|
if (labels.some(l => forbiddenLabels.includes(l.name))) {
|
|
throw new Error(`Forbidden labels detected: ${forbiddenLabels.join(', ')}`);
|
|
}
|
|
|
|
|