From 336cf585917a70b92fe72aaa795af0007bbf86d9 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 28 Oct 2025 17:02:52 +0000 Subject: [PATCH 1/7] feat: Add script and workflow to remove changelog scopes Co-authored-by: charles.francoise --- .github/scripts/README.md | 47 ++++++++ .github/scripts/remove-changelog-scopes.js | 104 ++++++++++++++++++ .../workflows/process-release-changelogs.yml | 53 +++++++++ 3 files changed, 204 insertions(+) create mode 100644 .github/scripts/README.md create mode 100755 .github/scripts/remove-changelog-scopes.js create mode 100644 .github/workflows/process-release-changelogs.yml diff --git a/.github/scripts/README.md b/.github/scripts/README.md new file mode 100644 index 0000000..c8a1968 --- /dev/null +++ b/.github/scripts/README.md @@ -0,0 +1,47 @@ +# GitHub Actions Scripts + +This directory contains scripts used by GitHub Actions workflows. + +## remove-changelog-scopes.js + +Post-processes `CHANGELOG.md` files to remove conventional commit scopes from changelog entries. + +### Usage + +```bash +node .github/scripts/remove-changelog-scopes.js +``` + +Where `` can be: +- A directory path (will recursively find all `CHANGELOG.md` files) +- A specific `CHANGELOG.md` file path + +### Example + +```bash +# Process all changelogs in packages directory +node .github/scripts/remove-changelog-scopes.js packages + +# Process a specific changelog +node .github/scripts/remove-changelog-scopes.js packages/core/CHANGELOG.md +``` + +### What it does + +Transforms changelog entries by removing scope prefixes: + +**Before:** +```markdown +* **docker:** docker remote tools ([#20](https://github.com/...)) +* **ssh:** only run specified tsdown build in e2e tests ([#22](https://github.com/...)) +``` + +**After:** +```markdown +* docker remote tools ([#20](https://github.com/...)) +* only run specified tsdown build in e2e tests ([#22](https://github.com/...)) +``` + +### Integration + +This script is automatically run by the `process-release-changelogs.yml` workflow whenever release-please creates or updates a release PR. diff --git a/.github/scripts/remove-changelog-scopes.js b/.github/scripts/remove-changelog-scopes.js new file mode 100755 index 0000000..004cbed --- /dev/null +++ b/.github/scripts/remove-changelog-scopes.js @@ -0,0 +1,104 @@ +#!/usr/bin/env node + +/** + * Post-processes CHANGELOG.md files to remove conventional commit scopes + * from changelog entries. + * + * Transforms entries like: + * * **docker:** docker remote tools (#20) + * Into: + * * docker remote tools (#20) + */ + +import fs from 'fs'; +import path from 'path'; +import { fileURLToPath } from 'url'; + +/** + * Remove scope prefixes from a changelog line + * Pattern matches: * **scope:** rest of line + */ +function removeScopeFromLine(content) { + // Match changelog bullet points with bold scope prefix + // e.g., "* **docker:** docker remote tools" becomes "* docker remote tools" + // Pattern explanation: + // - ^(\s*\*) - line start with optional whitespace and asterisk (bullet) + // - \s+ - one or more spaces + // - \*\* - opening bold markers + // - [^:*]+ - scope name (chars that aren't colon or asterisk) + // - :\*\* - colon inside the bold, then closing bold markers + // - \s+ - one or more spaces after + return content.replace(/^(\s*\*)\s+\*\*[^:*]+:\*\*\s+/gm, '$1 '); +} + +/** + * Find all CHANGELOG.md files recursively + */ +function findChangelogFiles(dir, files = []) { + const entries = fs.readdirSync(dir, { withFileTypes: true }); + + for (const entry of entries) { + const fullPath = path.join(dir, entry.name); + + if (entry.isDirectory()) { + // Skip node_modules and hidden directories + if (entry.name !== 'node_modules' && !entry.name.startsWith('.')) { + findChangelogFiles(fullPath, files); + } + } else if (entry.name === 'CHANGELOG.md') { + files.push(fullPath); + } + } + + return files; +} + +/** + * Process a single changelog file + */ +function processChangelogFile(filePath) { + console.log(`Processing ${filePath}...`); + + const content = fs.readFileSync(filePath, 'utf8'); + const processed = removeScopeFromLine(content); + + if (content !== processed) { + fs.writeFileSync(filePath, processed, 'utf8'); + console.log(` ✓ Removed scopes from ${filePath}`); + return true; + } else { + console.log(` - No scopes found in ${filePath}`); + return false; + } +} + +/** + * Main function + */ +function main() { + const searchPath = process.argv[2] || process.cwd(); + + console.log(`Searching for CHANGELOG.md files in: ${searchPath}\n`); + + const files = fs.statSync(searchPath).isDirectory() + ? findChangelogFiles(searchPath) + : [searchPath]; + + if (files.length === 0) { + console.log('No changelog files found.'); + return; + } + + console.log(`Found ${files.length} changelog file(s)\n`); + + let modifiedCount = 0; + for (const file of files) { + if (processChangelogFile(file)) { + modifiedCount++; + } + } + + console.log(`\nProcessed ${files.length} file(s), modified ${modifiedCount} file(s)`); +} + +main(); diff --git a/.github/workflows/process-release-changelogs.yml b/.github/workflows/process-release-changelogs.yml new file mode 100644 index 0000000..51c0693 --- /dev/null +++ b/.github/workflows/process-release-changelogs.yml @@ -0,0 +1,53 @@ +name: Process Release Changelogs + +on: + pull_request: + types: [opened, synchronize, reopened] + paths: + - '**/CHANGELOG.md' + +permissions: + contents: write + pull-requests: read + +jobs: + process-changelogs: + # Only run on release-please PRs + if: | + startsWith(github.head_ref, 'release-please--') || + contains(github.event.pull_request.labels.*.name, 'autorelease: pending') + runs-on: ubuntu-latest + steps: + - name: Checkout PR branch + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Remove scopes from changelogs + run: node .github/scripts/remove-changelog-scopes.js packages + + - name: Check for changes + id: check_changes + run: | + if git diff --quiet; then + echo "changed=false" >> $GITHUB_OUTPUT + echo "No changelog changes needed" + else + echo "changed=true" >> $GITHUB_OUTPUT + echo "Changelog changes detected" + fi + + - name: Commit changes + if: steps.check_changes.outputs.changed == 'true' + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add -u packages/**/CHANGELOG.md + git commit -m "chore: remove scopes from changelog entries" + git push From 6fcc45366518c3700fec1f650e04d1440ea3f624 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 28 Oct 2025 17:23:22 +0000 Subject: [PATCH 2/7] Refactor: Improve changelog scope processing script This commit enhances the changelog script to filter entries by package scope, remove scope prefixes, and clean up empty sections. Co-authored-by: charles.francoise --- .github/scripts/README.md | 53 ++++++- .github/scripts/remove-changelog-scopes.js | 171 ++++++++++++++++++--- 2 files changed, 196 insertions(+), 28 deletions(-) diff --git a/.github/scripts/README.md b/.github/scripts/README.md index c8a1968..b82b166 100644 --- a/.github/scripts/README.md +++ b/.github/scripts/README.md @@ -4,7 +4,10 @@ This directory contains scripts used by GitHub Actions workflows. ## remove-changelog-scopes.js -Post-processes `CHANGELOG.md` files to remove conventional commit scopes from changelog entries. +Post-processes `CHANGELOG.md` files to: +1. Filter entries by scope (keeping only entries that match the package name) +2. Remove scope prefixes from remaining entries +3. Clean up empty sections ### Usage @@ -28,18 +31,58 @@ node .github/scripts/remove-changelog-scopes.js packages/core/CHANGELOG.md ### What it does -Transforms changelog entries by removing scope prefixes: +#### 1. Filters entries by scope + +Entries are filtered based on the package name extracted from the changelog path. For `packages/ssh/CHANGELOG.md`: **Before:** ```markdown +### Features + * **docker:** docker remote tools ([#20](https://github.com/...)) -* **ssh:** only run specified tsdown build in e2e tests ([#22](https://github.com/...)) +* **ssh:** only run specified tsdown build ([#22](https://github.com/...)) +* **core:** update core definitions ([#23](https://github.com/...)) +``` + +**After (in ssh package):** +```markdown +### Features + +* only run specified tsdown build ([#22](https://github.com/...)) +``` + +#### 2. Handles multi-scope entries + +Entries with multiple scopes (e.g., `**ssh,docker:**`) are kept in all matching packages: + +**Before:** +```markdown +* **ssh,docker:** shared feature across packages ([#30](https://github.com/...)) +``` + +**After (in both ssh and docker packages):** +```markdown +* shared feature across packages ([#30](https://github.com/...)) +``` + +#### 3. Cleans up empty sections + +If a section has no remaining entries after filtering, the section header is removed: + +**Before:** +```markdown +### Features + +### Bug Fixes + +* some bug fix ``` **After:** ```markdown -* docker remote tools ([#20](https://github.com/...)) -* only run specified tsdown build in e2e tests ([#22](https://github.com/...)) +### Bug Fixes + +* some bug fix ``` ### Integration diff --git a/.github/scripts/remove-changelog-scopes.js b/.github/scripts/remove-changelog-scopes.js index 004cbed..6d1110c 100755 --- a/.github/scripts/remove-changelog-scopes.js +++ b/.github/scripts/remove-changelog-scopes.js @@ -1,13 +1,14 @@ #!/usr/bin/env node /** - * Post-processes CHANGELOG.md files to remove conventional commit scopes - * from changelog entries. + * Post-processes CHANGELOG.md files to: + * 1. Filter entries by scope (keep only entries matching the package name) + * 2. Remove scope prefixes from remaining entries * - * Transforms entries like: - * * **docker:** docker remote tools (#20) - * Into: - * * docker remote tools (#20) + * For example, in packages/ssh/CHANGELOG.md: + * - Keep: * **ssh:** only run specified tsdown build + * - Remove: * **docker:** docker remote tools + * - Then transform: * **ssh:** ... -> * ... */ import fs from 'fs'; @@ -15,20 +16,134 @@ import path from 'path'; import { fileURLToPath } from 'url'; /** - * Remove scope prefixes from a changelog line - * Pattern matches: * **scope:** rest of line + * Extract scope from a changelog line + * Returns the scope name or null if no scope found */ -function removeScopeFromLine(content) { - // Match changelog bullet points with bold scope prefix - // e.g., "* **docker:** docker remote tools" becomes "* docker remote tools" - // Pattern explanation: - // - ^(\s*\*) - line start with optional whitespace and asterisk (bullet) - // - \s+ - one or more spaces - // - \*\* - opening bold markers - // - [^:*]+ - scope name (chars that aren't colon or asterisk) - // - :\*\* - colon inside the bold, then closing bold markers - // - \s+ - one or more spaces after - return content.replace(/^(\s*\*)\s+\*\*[^:*]+:\*\*\s+/gm, '$1 '); +function extractScope(line) { + const match = line.match(/^\s*\*\s+\*\*([^:*]+):\*\*\s+/); + return match ? match[1] : null; +} + +/** + * Extract package name from changelog path + * e.g., "packages/ssh/CHANGELOG.md" -> "ssh" + * e.g., "/some/path/docker/CHANGELOG.md" -> "docker" + */ +function extractPackageName(changelogPath) { + const parts = changelogPath.split(path.sep); + + // First try to find it after "packages" directory + const packagesIndex = parts.indexOf('packages'); + if (packagesIndex >= 0 && packagesIndex < parts.length - 1) { + return parts[packagesIndex + 1]; + } + + // Otherwise, use the parent directory of CHANGELOG.md + const changelogIndex = parts.findIndex(p => p === 'CHANGELOG.md'); + if (changelogIndex > 0) { + return parts[changelogIndex - 1]; + } + + return null; +} + +/** + * Check if a scope matches the package name + * Handles multiple scopes separated by comma + */ +function scopeMatchesPackage(scope, packageName) { + if (!scope || !packageName) { + return false; + } + + // Handle multiple scopes like "ssh,docker" + const scopes = scope.split(',').map(s => s.trim()); + return scopes.includes(packageName); +} + +/** + * Clean up empty sections (e.g., "### Features" with no entries) + */ +function cleanEmptySections(content) { + const lines = content.split('\n'); + const result = []; + let i = 0; + + while (i < lines.length) { + const line = lines[i]; + + // Check if this is a section header (### Something) + if (line.match(/^###\s+/)) { + // Look ahead to see if there are any entries in this section + let j = i + 1; + let hasEntries = false; + + // Skip empty lines after the header + while (j < lines.length && lines[j].trim() === '') { + j++; + } + + // Check if next non-empty line is an entry (starts with *) + if (j < lines.length && lines[j].match(/^\s*\*/)) { + hasEntries = true; + } + + if (hasEntries) { + // Keep the section header + result.push(line); + } else { + // Skip the section header and any empty lines after it + i = j - 1; + } + } else { + result.push(line); + } + + i++; + } + + // Remove any trailing empty lines before the next section + let cleaned = result.join('\n'); + cleaned = cleaned.replace(/\n\n\n+/g, '\n\n'); // Reduce multiple empty lines to double + + return cleaned; +} + +/** + * Filter changelog entries by scope and remove scope prefixes + */ +function processChangelogContent(content, packageName) { + if (!packageName) { + // If we can't determine package name, just remove scopes without filtering + return content.replace(/^(\s*\*)\s+\*\*[^:*]+:\*\*\s+/gm, '$1 '); + } + + const lines = content.split('\n'); + const result = []; + let i = 0; + + while (i < lines.length) { + const line = lines[i]; + const scope = extractScope(line); + + if (scope !== null) { + // This is a changelog entry with a scope + if (scopeMatchesPackage(scope, packageName)) { + // Keep this entry and remove the scope prefix + const cleanedLine = line.replace(/^(\s*\*)\s+\*\*[^:*]+:\*\*\s+/, '$1 '); + result.push(cleanedLine); + } + // else: skip this line (different scope) + } else { + // Not a scoped entry, keep as-is + result.push(line); + } + + i++; + } + + const filtered = result.join('\n'); + return cleanEmptySections(filtered); } /** @@ -57,17 +172,27 @@ function findChangelogFiles(dir, files = []) { * Process a single changelog file */ function processChangelogFile(filePath) { - console.log(`Processing ${filePath}...`); + const packageName = extractPackageName(filePath); + console.log(`Processing ${filePath}${packageName ? ` (package: ${packageName})` : ''}...`); const content = fs.readFileSync(filePath, 'utf8'); - const processed = removeScopeFromLine(content); + const processed = processChangelogContent(content, packageName); if (content !== processed) { fs.writeFileSync(filePath, processed, 'utf8'); - console.log(` ✓ Removed scopes from ${filePath}`); + + // Count changes + const originalLines = content.split('\n').filter(l => extractScope(l) !== null); + const processedLines = processed.split('\n').filter(l => extractScope(l) !== null); + const removedCount = originalLines.length - processedLines.length; + + if (removedCount > 0) { + console.log(` ✓ Filtered ${removedCount} entry/entries with non-matching scope(s)`); + } + console.log(` ✓ Removed scope prefixes from ${filePath}`); return true; } else { - console.log(` - No scopes found in ${filePath}`); + console.log(` - No changes needed in ${filePath}`); return false; } } From 3ad57c26a2cd4acbeb6c3f34b2b5b70d15af7151 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 28 Oct 2025 17:32:50 +0000 Subject: [PATCH 3/7] Remove unused GitHub Actions script Co-authored-by: charles.francoise --- .github/scripts/README.md | 90 --------------------------------------- 1 file changed, 90 deletions(-) delete mode 100644 .github/scripts/README.md diff --git a/.github/scripts/README.md b/.github/scripts/README.md deleted file mode 100644 index b82b166..0000000 --- a/.github/scripts/README.md +++ /dev/null @@ -1,90 +0,0 @@ -# GitHub Actions Scripts - -This directory contains scripts used by GitHub Actions workflows. - -## remove-changelog-scopes.js - -Post-processes `CHANGELOG.md` files to: -1. Filter entries by scope (keeping only entries that match the package name) -2. Remove scope prefixes from remaining entries -3. Clean up empty sections - -### Usage - -```bash -node .github/scripts/remove-changelog-scopes.js -``` - -Where `` can be: -- A directory path (will recursively find all `CHANGELOG.md` files) -- A specific `CHANGELOG.md` file path - -### Example - -```bash -# Process all changelogs in packages directory -node .github/scripts/remove-changelog-scopes.js packages - -# Process a specific changelog -node .github/scripts/remove-changelog-scopes.js packages/core/CHANGELOG.md -``` - -### What it does - -#### 1. Filters entries by scope - -Entries are filtered based on the package name extracted from the changelog path. For `packages/ssh/CHANGELOG.md`: - -**Before:** -```markdown -### Features - -* **docker:** docker remote tools ([#20](https://github.com/...)) -* **ssh:** only run specified tsdown build ([#22](https://github.com/...)) -* **core:** update core definitions ([#23](https://github.com/...)) -``` - -**After (in ssh package):** -```markdown -### Features - -* only run specified tsdown build ([#22](https://github.com/...)) -``` - -#### 2. Handles multi-scope entries - -Entries with multiple scopes (e.g., `**ssh,docker:**`) are kept in all matching packages: - -**Before:** -```markdown -* **ssh,docker:** shared feature across packages ([#30](https://github.com/...)) -``` - -**After (in both ssh and docker packages):** -```markdown -* shared feature across packages ([#30](https://github.com/...)) -``` - -#### 3. Cleans up empty sections - -If a section has no remaining entries after filtering, the section header is removed: - -**Before:** -```markdown -### Features - -### Bug Fixes - -* some bug fix -``` - -**After:** -```markdown -### Bug Fixes - -* some bug fix -``` - -### Integration - -This script is automatically run by the `process-release-changelogs.yml` workflow whenever release-please creates or updates a release PR. From e12791eb32764efe882e5a692a529b5f885ad454 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 28 Oct 2025 17:36:29 +0000 Subject: [PATCH 4/7] Refactor: Simplify changelog package name extraction Co-authored-by: charles.francoise --- .github/scripts/remove-changelog-scopes.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/scripts/remove-changelog-scopes.js b/.github/scripts/remove-changelog-scopes.js index 6d1110c..618c7d3 100755 --- a/.github/scripts/remove-changelog-scopes.js +++ b/.github/scripts/remove-changelog-scopes.js @@ -26,24 +26,16 @@ function extractScope(line) { /** * Extract package name from changelog path + * Uses the parent directory of CHANGELOG.md * e.g., "packages/ssh/CHANGELOG.md" -> "ssh" * e.g., "/some/path/docker/CHANGELOG.md" -> "docker" */ function extractPackageName(changelogPath) { const parts = changelogPath.split(path.sep); - - // First try to find it after "packages" directory - const packagesIndex = parts.indexOf('packages'); - if (packagesIndex >= 0 && packagesIndex < parts.length - 1) { - return parts[packagesIndex + 1]; - } - - // Otherwise, use the parent directory of CHANGELOG.md const changelogIndex = parts.findIndex(p => p === 'CHANGELOG.md'); if (changelogIndex > 0) { return parts[changelogIndex - 1]; } - return null; } From 70600dc2e2630477de87e7acda6025f21d1a5d11 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 28 Oct 2025 17:39:33 +0000 Subject: [PATCH 5/7] chore(ci): simplify package extraction and fix eslint config - Simplify extractPackageName to only use parent directory strategy - Add .github/**/* to eslint ignores to exclude workflow scripts --- .github/scripts/remove-changelog-scopes.js | 85 +++++++++++++--------- eslint.config.js | 9 ++- 2 files changed, 57 insertions(+), 37 deletions(-) diff --git a/.github/scripts/remove-changelog-scopes.js b/.github/scripts/remove-changelog-scopes.js index 618c7d3..0251f9b 100755 --- a/.github/scripts/remove-changelog-scopes.js +++ b/.github/scripts/remove-changelog-scopes.js @@ -4,7 +4,7 @@ * Post-processes CHANGELOG.md files to: * 1. Filter entries by scope (keep only entries matching the package name) * 2. Remove scope prefixes from remaining entries - * + * * For example, in packages/ssh/CHANGELOG.md: * - Keep: * **ssh:** only run specified tsdown build * - Remove: * **docker:** docker remote tools @@ -32,7 +32,7 @@ function extractScope(line) { */ function extractPackageName(changelogPath) { const parts = changelogPath.split(path.sep); - const changelogIndex = parts.findIndex(p => p === 'CHANGELOG.md'); + const changelogIndex = parts.findIndex((p) => p === 'CHANGELOG.md'); if (changelogIndex > 0) { return parts[changelogIndex - 1]; } @@ -47,9 +47,9 @@ function scopeMatchesPackage(scope, packageName) { if (!scope || !packageName) { return false; } - + // Handle multiple scopes like "ssh,docker" - const scopes = scope.split(',').map(s => s.trim()); + const scopes = scope.split(',').map((s) => s.trim()); return scopes.includes(packageName); } @@ -60,26 +60,26 @@ function cleanEmptySections(content) { const lines = content.split('\n'); const result = []; let i = 0; - + while (i < lines.length) { const line = lines[i]; - + // Check if this is a section header (### Something) if (line.match(/^###\s+/)) { // Look ahead to see if there are any entries in this section let j = i + 1; let hasEntries = false; - + // Skip empty lines after the header while (j < lines.length && lines[j].trim() === '') { j++; } - + // Check if next non-empty line is an entry (starts with *) if (j < lines.length && lines[j].match(/^\s*\*/)) { hasEntries = true; } - + if (hasEntries) { // Keep the section header result.push(line); @@ -90,14 +90,14 @@ function cleanEmptySections(content) { } else { result.push(line); } - + i++; } - + // Remove any trailing empty lines before the next section let cleaned = result.join('\n'); cleaned = cleaned.replace(/\n\n\n+/g, '\n\n'); // Reduce multiple empty lines to double - + return cleaned; } @@ -109,20 +109,23 @@ function processChangelogContent(content, packageName) { // If we can't determine package name, just remove scopes without filtering return content.replace(/^(\s*\*)\s+\*\*[^:*]+:\*\*\s+/gm, '$1 '); } - + const lines = content.split('\n'); const result = []; let i = 0; - + while (i < lines.length) { const line = lines[i]; const scope = extractScope(line); - + if (scope !== null) { // This is a changelog entry with a scope if (scopeMatchesPackage(scope, packageName)) { // Keep this entry and remove the scope prefix - const cleanedLine = line.replace(/^(\s*\*)\s+\*\*[^:*]+:\*\*\s+/, '$1 '); + const cleanedLine = line.replace( + /^(\s*\*)\s+\*\*[^:*]+:\*\*\s+/, + '$1 ', + ); result.push(cleanedLine); } // else: skip this line (different scope) @@ -130,10 +133,10 @@ function processChangelogContent(content, packageName) { // Not a scoped entry, keep as-is result.push(line); } - + i++; } - + const filtered = result.join('\n'); return cleanEmptySections(filtered); } @@ -143,10 +146,10 @@ function processChangelogContent(content, packageName) { */ function findChangelogFiles(dir, files = []) { const entries = fs.readdirSync(dir, { withFileTypes: true }); - + for (const entry of entries) { const fullPath = path.join(dir, entry.name); - + if (entry.isDirectory()) { // Skip node_modules and hidden directories if (entry.name !== 'node_modules' && !entry.name.startsWith('.')) { @@ -156,7 +159,7 @@ function findChangelogFiles(dir, files = []) { files.push(fullPath); } } - + return files; } @@ -165,21 +168,29 @@ function findChangelogFiles(dir, files = []) { */ function processChangelogFile(filePath) { const packageName = extractPackageName(filePath); - console.log(`Processing ${filePath}${packageName ? ` (package: ${packageName})` : ''}...`); - + console.log( + `Processing ${filePath}${packageName ? ` (package: ${packageName})` : ''}...`, + ); + const content = fs.readFileSync(filePath, 'utf8'); const processed = processChangelogContent(content, packageName); - + if (content !== processed) { fs.writeFileSync(filePath, processed, 'utf8'); - + // Count changes - const originalLines = content.split('\n').filter(l => extractScope(l) !== null); - const processedLines = processed.split('\n').filter(l => extractScope(l) !== null); + const originalLines = content + .split('\n') + .filter((l) => extractScope(l) !== null); + const processedLines = processed + .split('\n') + .filter((l) => extractScope(l) !== null); const removedCount = originalLines.length - processedLines.length; - + if (removedCount > 0) { - console.log(` ✓ Filtered ${removedCount} entry/entries with non-matching scope(s)`); + console.log( + ` ✓ Filtered ${removedCount} entry/entries with non-matching scope(s)`, + ); } console.log(` ✓ Removed scope prefixes from ${filePath}`); return true; @@ -194,28 +205,30 @@ function processChangelogFile(filePath) { */ function main() { const searchPath = process.argv[2] || process.cwd(); - + console.log(`Searching for CHANGELOG.md files in: ${searchPath}\n`); - + const files = fs.statSync(searchPath).isDirectory() ? findChangelogFiles(searchPath) : [searchPath]; - + if (files.length === 0) { console.log('No changelog files found.'); return; } - + console.log(`Found ${files.length} changelog file(s)\n`); - + let modifiedCount = 0; for (const file of files) { if (processChangelogFile(file)) { modifiedCount++; } } - - console.log(`\nProcessed ${files.length} file(s), modified ${modifiedCount} file(s)`); + + console.log( + `\nProcessed ${files.length} file(s), modified ${modifiedCount} file(s)`, + ); } main(); diff --git a/eslint.config.js b/eslint.config.js index 50bd6a5..512a316 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -9,7 +9,14 @@ import tseslint from 'typescript-eslint'; /** @type {import('eslint').Linter.Config[]} */ export default [ { files: ['**/*.{js,mjs,cjs,ts}'] }, - { ignores: ['**/dist/**/*', 'sandbox/**/*', '**/examples/**/*'] }, + { + ignores: [ + '**/dist/**/*', + 'sandbox/**/*', + '**/examples/**/*', + '.github/**/*', + ], + }, { languageOptions: { globals: { ...globals.browser, ...globals.node } }, }, From 237af58d7546fda962db1a5608bf96295fe40091 Mon Sep 17 00:00:00 2001 From: Charles Francoise Date: Wed, 29 Oct 2025 14:45:11 +0100 Subject: [PATCH 6/7] lint after edit --- .github/workflows/process-release-changelogs.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/process-release-changelogs.yml b/.github/workflows/process-release-changelogs.yml index 51c0693..031069e 100644 --- a/.github/workflows/process-release-changelogs.yml +++ b/.github/workflows/process-release-changelogs.yml @@ -4,7 +4,7 @@ on: pull_request: types: [opened, synchronize, reopened] paths: - - '**/CHANGELOG.md' + - "**/CHANGELOG.md" permissions: contents: write @@ -27,10 +27,12 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '20' + node-version: "20" - name: Remove scopes from changelogs - run: node .github/scripts/remove-changelog-scopes.js packages + run: | + node .github/scripts/remove-changelog-scopes.js packages + pnpm run lint:fix - name: Check for changes id: check_changes From c17f569792b61699690fc363a037bcb0c00f5fd7 Mon Sep 17 00:00:00 2001 From: Charles Francoise Date: Wed, 29 Oct 2025 14:50:12 +0100 Subject: [PATCH 7/7] prettier YAML --- .github/workflows/process-release-changelogs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/process-release-changelogs.yml b/.github/workflows/process-release-changelogs.yml index 031069e..01c2521 100644 --- a/.github/workflows/process-release-changelogs.yml +++ b/.github/workflows/process-release-changelogs.yml @@ -4,7 +4,7 @@ on: pull_request: types: [opened, synchronize, reopened] paths: - - "**/CHANGELOG.md" + - '**/CHANGELOG.md' permissions: contents: write @@ -27,7 +27,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: "20" + node-version: '20' - name: Remove scopes from changelogs run: |