mirror of
https://github.com/Xevion/linkpulse.git
synced 2025-12-15 22:12:06 -06:00
use error command, functional processing, fix unreleased case sensitivity, global process
This commit is contained in:
32
.github/workflows/checklist.yaml
vendored
32
.github/workflows/checklist.yaml
vendored
@@ -13,22 +13,34 @@ jobs:
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = 'CHANGELOG.md';
|
const path = 'CHANGELOG.md';
|
||||||
const changelog = fs.readFileSync(path, 'utf8');
|
const changelog = fs.readFileSync(path, 'utf8');
|
||||||
|
const errors = [];
|
||||||
// Check for 'UNRELEASED'
|
|
||||||
if (changelog.includes('UNRELEASED')) {
|
|
||||||
throw new Error('Changelog contains "UNRELEASED"');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check each line that starts with '##' for the version & date format
|
// Check each line that starts with '##' for the version & date format
|
||||||
const lines = changelog.split('\n');
|
changelog.split('\n').forEach((line, index) => {
|
||||||
for (const line of lines) {
|
index += 1;
|
||||||
if (line.startsWith('## ')) {
|
|
||||||
|
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'
|
// Expected format: '## [X.Y.Z] - YYYY-MM-DD'
|
||||||
const pattern = /^\d+\.\d+\.\d+ - \d{4}-\d{2}-\d{2}$/;
|
const pattern = /^\d+\.\d+\.\d+ - \d{4}-\d{2}-\d{2}$/;
|
||||||
if (pattern.test(line)) {
|
if (pattern.test(line)) {
|
||||||
throw new Error(`Invalid version/date format: ${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:
|
draft:
|
||||||
|
|||||||
Reference in New Issue
Block a user