name: Checklist on: [pull_request] jobs: changelog: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/github-script@v7 with: script: | const core = require('@actions/core'); const fs = require('fs'); const path = 'CHANGELOG.md'; const changelog = fs.readFileSync(path, 'utf8'); let failed = false; try { // 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')) { core.error({ title: 'Unreleased Section Found', file: path, startline: index, }); failed = true; } // Expected format: '## [X.Y.Z] - YYYY-MM-DD' const pattern = /^\d+\.\d+\.\d+ - \d{4}-\d{2}-\d{2}$/; if (pattern.test(line)) { core.error({ title: 'Invalid Version/Date Format', file: path, startline: index, }); failed = true; } }); if (failed) { core.setFailed('Changelog validation failed') } } catch (error) { core.setFailed(`Exception occurred while validating changelog: ${error}`); } draft: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/github-script@v7 with: script: | const core = require('@actions/core') const forbiddenLabels = ['draft']; let labels = context.payload.pull_request.labels; if (labels.some(l => forbiddenLabels.includes(l.name))) { core.setFailed(`Forbidden labels detected: ${forbiddenLabels.join(', ')}`); }