From 7b25c0d590577b0271dfcac0fdda4f9d3bf618cd Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Thu, 13 Mar 2025 11:50:36 -0500 Subject: [PATCH 01/41] changelog checker --- .github/workflows/changelog-check.yml | 61 +++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/changelog-check.yml diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml new file mode 100644 index 00000000..2605b0bf --- /dev/null +++ b/.github/workflows/changelog-check.yml @@ -0,0 +1,61 @@ +name: Changelog Check + +on: + workflow_call: + inputs: + pr_number: + required: true + type: string + base_branch: + required: true + type: string + feature_branch: + required: true + type: string + secrets: + GITHUB_TOKEN: + required: true + +jobs: + check-changelog: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ inputs.feature_branch }} + + - name: Fetch base branch for comparison + run: | + git fetch origin ${{ inputs.base_branch }} + + - name: Check if 'CHANGELOG.md' was modified + id: check_changes + run: | + if git diff --name-only origin/${{ inputs.base_branch }}...${{ inputs.feature_branch }} | grep -q '^CHANGELOG\.md$'; then + echo "changelog_modified=true" >> $GITHUB_ENV + else + echo "changelog_modified=false" >> $GITHUB_ENV + fi + + - name: Check if 'no-changelog-required' label exists + id: check_label + run: | + LABELS=$(gh pr view ${{ inputs.pr_number }} --json labels --jq '.labels[].name') + if echo "$LABELS" | grep -q "no-changelog-required"; then + echo "label_exists=true" >> $GITHUB_ENV + else + echo "label_exists=false" >> $GITHUB_ENV + fi + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Determine action result + run: | + if [[ "$changelog_modified" == "true" || "$label_exists" == "true" ]]; then + echo "✅ Either CHANGELOG.md was modified or 'no-changelog-required' label exists. Passing." + exit 0 + else + echo "❌ CHANGELOG.md was not modified and no 'no-changelog-required' label found. Failing." + exit 1 + fi From 5ab5c52c2890e666e8dae32e785e5088cd205d8b Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Thu, 13 Mar 2025 13:27:42 -0500 Subject: [PATCH 02/41] updated syntax --- .github/workflows/changelog-check.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index 2605b0bf..197bf763 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -3,17 +3,17 @@ name: Changelog Check on: workflow_call: inputs: - pr_number: + pr-number: required: true type: string - base_branch: + base-branch: required: true type: string - feature_branch: + feature-branch: required: true type: string secrets: - GITHUB_TOKEN: + gh-token: required: true jobs: @@ -48,7 +48,7 @@ jobs: echo "label_exists=false" >> $GITHUB_ENV fi env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.gh-token }} - name: Determine action result run: | From 8a89ebd93fdbde5f358bc2c8435b269db295550a Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Thu, 13 Mar 2025 13:30:47 -0500 Subject: [PATCH 03/41] updated logic --- .github/workflows/changelog-check.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index 197bf763..2e2f3f3f 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -23,16 +23,17 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 with: - ref: ${{ inputs.feature_branch }} + fetch-depth: 0 # Ensure full history is fetched + ref: ${{ inputs.feature-branch }} - name: Fetch base branch for comparison run: | - git fetch origin ${{ inputs.base_branch }} + git fetch origin ${{ inputs.base-branch }} - name: Check if 'CHANGELOG.md' was modified id: check_changes run: | - if git diff --name-only origin/${{ inputs.base_branch }}...${{ inputs.feature_branch }} | grep -q '^CHANGELOG\.md$'; then + if git diff --name-only origin/${{ inputs.base-branch }} ${{ inputs.feature-branch }} | grep -q '^CHANGELOG\.md$'; then echo "changelog_modified=true" >> $GITHUB_ENV else echo "changelog_modified=false" >> $GITHUB_ENV @@ -40,15 +41,15 @@ jobs: - name: Check if 'no-changelog-required' label exists id: check_label + env: + GH_TOKEN: ${{ secrets.gh-token }} run: | - LABELS=$(gh pr view ${{ inputs.pr_number }} --json labels --jq '.labels[].name') + LABELS=$(gh pr view ${{ inputs.pr-number }} --json labels --jq '.labels[].name') if echo "$LABELS" | grep -q "no-changelog-required"; then echo "label_exists=true" >> $GITHUB_ENV else echo "label_exists=false" >> $GITHUB_ENV fi - env: - GH_TOKEN: ${{ secrets.gh-token }} - name: Determine action result run: | @@ -58,4 +59,4 @@ jobs: else echo "❌ CHANGELOG.md was not modified and no 'no-changelog-required' label found. Failing." exit 1 - fi + fi \ No newline at end of file From c8d98fd6177043a07c4b6ed10c2d0ef10b7cc333 Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Thu, 13 Mar 2025 15:23:50 -0500 Subject: [PATCH 04/41] updates to ts approach --- .github/workflows/changelog-check.yml | 60 +++-- package.json | 14 +- src/changelog-check.ts | 154 +++++++++++++ yarn.lock | 311 +++++++++++++++++++++++++- 4 files changed, 496 insertions(+), 43 deletions(-) create mode 100644 src/changelog-check.ts diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index 2e2f3f3f..2d87d416 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -20,43 +20,37 @@ jobs: check-changelog: runs-on: ubuntu-latest steps: - - name: Checkout repository + # Step 1: Checkout github-tools repository + - name: Checkout github-tools repository uses: actions/checkout@v4 with: - fetch-depth: 0 # Ensure full history is fetched - ref: ${{ inputs.feature-branch }} + repository: MetaMask/github-tools + ref: changelog-checker + path: github-tools - - name: Fetch base branch for comparison - run: | - git fetch origin ${{ inputs.base-branch }} + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version-file: ./github-tools/.nvmrc + cache-dependency-path: ./github-tools/yarn.lock + cache: yarn - - name: Check if 'CHANGELOG.md' was modified - id: check_changes - run: | - if git diff --name-only origin/${{ inputs.base-branch }} ${{ inputs.feature-branch }} | grep -q '^CHANGELOG\.md$'; then - echo "changelog_modified=true" >> $GITHUB_ENV - else - echo "changelog_modified=false" >> $GITHUB_ENV - fi + - name: Enable Corepack + run: corepack enable + shell: bash + working-directory: ./github-tools - - name: Check if 'no-changelog-required' label exists - id: check_label - env: - GH_TOKEN: ${{ secrets.gh-token }} - run: | - LABELS=$(gh pr view ${{ inputs.pr-number }} --json labels --jq '.labels[].name') - if echo "$LABELS" | grep -q "no-changelog-required"; then - echo "label_exists=true" >> $GITHUB_ENV - else - echo "label_exists=false" >> $GITHUB_ENV - fi + - name: Install dependencies + run: yarn --immutable + shell: bash + working-directory: ./github-tools - - name: Determine action result + # Step 4: Run Script + - name: Check Changelog + id: check-changelog + shell: bash + env: + GITHUB_TOKEN: ${{ secrets.gh-token }} + working-directory: ./github-tools run: | - if [[ "$changelog_modified" == "true" || "$label_exists" == "true" ]]; then - echo "✅ Either CHANGELOG.md was modified or 'no-changelog-required' label exists. Passing." - exit 0 - else - echo "❌ CHANGELOG.md was not modified and no 'no-changelog-required' label found. Failing." - exit 1 - fi \ No newline at end of file + yarn run check-changelog ${{ github.repository }} ${{ inputs.base-branch }} ${{ inputs.feature-branch }} \ No newline at end of file diff --git a/package.json b/package.json index 5b77bc9c..22103de4 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,8 @@ "slack:release-testing": "node .github/scripts/slack-release-testing.mjs", "test": "jest && jest-it-up", "test:watch": "jest --watch", - "update-release-sheet": "node .github/scripts/update-release-sheet.mjs" + "update-release-sheet": "node .github/scripts/update-release-sheet.mjs", + "changelog-check": "ts-node src/changelog-check.ts" }, "dependencies": { "@metamask/utils": "^7.1.0", @@ -26,10 +27,15 @@ "@octokit/rest": "^19.0.13", "@slack/web-api": "^6.0.0", "@types/luxon": "^3.3.0", - "axios": "^0.24.0", + "axios": "^1.8.3", + "changelog-parser": "3.0.1", "csv-parse": "5.6.0", + "diff": "^7.0.0", + "fs-extra": "11.3.0", "googleapis": "144.0.0", + "isomorphic-git": "1.29.0", "luxon": "^3.3.0", + "node-fetch": "^3.3.2", "ora": "^5.4.1", "simple-git": "3.27.0" }, @@ -42,8 +48,12 @@ "@metamask/eslint-config-typescript": "^12.0.0", "@swc/cli": "^0.1.62", "@swc/core": "^1.3.80", + "@types/axios": "^0.14.4", + "@types/diff": "^7", + "@types/fs-extra": "^11.0.4", "@types/jest": "^28.1.6", "@types/node": "^20.3.2", + "@types/node-fetch": "^2.6.12", "@typescript-eslint/eslint-plugin": "^5.43.0", "@typescript-eslint/parser": "^5.43.0", "depcheck": "^1.4.3", diff --git a/src/changelog-check.ts b/src/changelog-check.ts new file mode 100644 index 00000000..557e1507 --- /dev/null +++ b/src/changelog-check.ts @@ -0,0 +1,154 @@ +import { diffLines } from "diff"; // Import diff library +import axios from "axios"; + +// Manually define types for changelog-parser since it lacks official TypeScript support +interface Release { + version: string | null; + title: string; + date: string | null; + body: string; + parsed: Record; + } + + interface Changelog { + title: string; + description: string; + versions: Release[]; + } + + // Import changelog-parser as an untyped module + const changelogParser: (options: { filePath?: string; text?: string }) => Promise = require("changelog-parser"); + + +const repoPath = process.cwd(); // Root directory for any temp storage + +// Function to fetch the raw file content from GitHub +async function fetchChangelogFromGitHub(repo: string, branch: string): Promise { + // Use raw.githubusercontent.com to directly fetch file content + const url = `https://raw.githubusercontent.com/MetaMask/${repo}/${branch}/CHANGELOG.md`; + const token = process.env.GITHUB_TOKEN || ""; + + try { + const response = await axios.get(url, { + headers: token ? { Authorization: `Bearer ${token}` } : {}, + responseType: "text", // Ensure we get raw text + }); + + return response.data; // Directly return the raw content + } catch (error) { + console.error(`❌ Error fetching CHANGELOG.md from ${branch} on ${repo}:`, error); + return ""; + } +} + +// Function to parse the changelog and extract "Unreleased" section +async function parseChangelog(content: string): Promise { + try { + const parsed: Changelog = await changelogParser({ text: content }); + + // Try to find the "[Unreleased]" section + const unreleasedSection = parsed.versions.find(v => v.title.trim().toLowerCase() === "[unreleased]"); + + if (!unreleasedSection) { + console.warn("⚠️ '[Unreleased]' section not found! Check the formatting in CHANGELOG.md."); + return ""; + } + + return unreleasedSection.body + + } catch (error) { + console.error("❌ Error parsing CHANGELOG.md:", error); + return ""; + } +} + +function displayDiff(baseChanges: string, featureChanges: string) { + + // Compute the line-by-line differences +const differences = diffLines(baseChanges, featureChanges); + +const addedLines: string[] = []; +const removedLines: string[] = []; + +// Collect added and removed lines into separate lists +differences.forEach(part => { + if (part.added) { + addedLines.push(part.value.trim()); // Trim to remove leading/trailing spaces + } else if (part.removed) { + removedLines.push(part.value.trim()); + } +}); + +// Print the diff summary +console.log("🔍 Diff between base and feature '[Unreleased]' sections:"); + +if (removedLines.length > 0) { + console.log("\x1b[31m❌ Removed:\x1b[0m"); + removedLines.forEach(line => console.log(`\x1b[31m- ${line}\x1b[0m`)); +} else { + console.log("\x1b[31m❌ No removed lines.\x1b[0m"); +} + +if (addedLines.length > 0) { + console.log("\x1b[32m✅ Added:\x1b[0m"); + addedLines.forEach(line => console.log(`\x1b[32m+ ${line}\x1b[0m`)); +} else { + console.log("\x1b[32m✅ No added lines.\x1b[0m"); +} + +} + +// Main function to validate the changelog +async function validateChangelog(repo: string, baseBranch: string, featureBranch: string) { + console.log(`🔍 Fetching CHANGELOG.md from GitHub repository: ${repo}`); + + // Fetch CHANGELOG.md from both branches + const baseChangelogContent = await fetchChangelogFromGitHub(repo, baseBranch); + const featureChangelogContent = await fetchChangelogFromGitHub(repo, featureBranch); + + if (!featureChangelogContent) { + console.log("❌ CHANGELOG.md is missing in the feature branch."); + process.exit(1); + } + + // Parse the changelogs + const baseChanges = await parseChangelog(baseChangelogContent); + const featureChanges = await parseChangelog(featureChangelogContent); + + console.log("🔍 Comparing changelog entries..."); + + console.log("Base unreleased section:", baseChanges); + console.log("Feature unreleased section:", featureChanges); + + displayDiff(baseChanges, featureChanges); + + if (baseChanges === featureChanges) { + console.log("❌ No new entries detected under '## Unreleased'. Please update the changelog."); + process.exit(1); + } + + console.log("✅ CHANGELOG.md has been correctly updated."); + process.exit(0); +} + +// Parse command-line arguments +const args = process.argv.slice(2); +if (args.length < 3) { + console.error("❌ Usage: node scripts/check-changelog.js "); + process.exit(1); +} + +const [githubRepo, baseBranch, featureBranch] = args; + +// Ensure all required arguments are provided +if (!githubRepo || !baseBranch || !featureBranch) { + console.error("❌ Error: Missing required arguments."); + console.error("✅ Usage: node scripts/check-changelog.js "); + process.exit(1); +} + +// Run the validation +validateChangelog(githubRepo, baseBranch, featureBranch).catch(error => { + console.error("❌ Unexpected error:", error); + process.exit(1); +}); diff --git a/yarn.lock b/yarn.lock index 9a7e42e0..1ab5629d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1008,14 +1008,20 @@ __metadata: "@slack/web-api": "npm:^6.0.0" "@swc/cli": "npm:^0.1.62" "@swc/core": "npm:^1.3.80" + "@types/axios": "npm:^0.14.4" + "@types/diff": "npm:^7" + "@types/fs-extra": "npm:^11.0.4" "@types/jest": "npm:^28.1.6" "@types/luxon": "npm:^3.3.0" "@types/node": "npm:^20.3.2" + "@types/node-fetch": "npm:^2.6.12" "@typescript-eslint/eslint-plugin": "npm:^5.43.0" "@typescript-eslint/parser": "npm:^5.43.0" - axios: "npm:^0.24.0" + axios: "npm:^1.8.3" + changelog-parser: "npm:3.0.1" csv-parse: "npm:5.6.0" depcheck: "npm:^1.4.3" + diff: "npm:^7.0.0" eslint: "npm:^8.44.0" eslint-config-prettier: "npm:^8.8.0" eslint-plugin-import: "npm:^2.27.5" @@ -1024,10 +1030,13 @@ __metadata: eslint-plugin-n: "npm:^15.7.0" eslint-plugin-prettier: "npm:^4.2.1" eslint-plugin-promise: "npm:^6.1.1" + fs-extra: "npm:11.3.0" googleapis: "npm:144.0.0" + isomorphic-git: "npm:1.29.0" jest: "npm:^28.1.3" jest-it-up: "npm:^2.0.2" luxon: "npm:^3.3.0" + node-fetch: "npm:^3.3.2" ora: "npm:^5.4.1" prettier: "npm:^2.7.1" prettier-plugin-packagejson: "npm:^2.3.0" @@ -1659,6 +1668,15 @@ __metadata: languageName: node linkType: hard +"@types/axios@npm:^0.14.4": + version: 0.14.4 + resolution: "@types/axios@npm:0.14.4" + dependencies: + axios: "npm:*" + checksum: 10/51defed1e76e3fa7e63ae999c2e8c7c253be9b1a1fa3006f4413a0c461234a7e9e7e5df1bb2f64be221617fa94ed2272345ef19724dd550ad01a090510714275 + languageName: node + linkType: hard + "@types/babel__core@npm:^7.1.14": version: 7.1.19 resolution: "@types/babel__core@npm:7.1.19" @@ -1728,6 +1746,23 @@ __metadata: languageName: node linkType: hard +"@types/diff@npm:^7": + version: 7.0.1 + resolution: "@types/diff@npm:7.0.1" + checksum: 10/ef8c5fe0ea56737e8967c3db5e78518134f704e8e2971cb4ba6f2ed46ed5e13b4bbe41a6b2b78122b8f47c618ac25550f85a681633636a3a020369042523295d + languageName: node + linkType: hard + +"@types/fs-extra@npm:^11.0.4": + version: 11.0.4 + resolution: "@types/fs-extra@npm:11.0.4" + dependencies: + "@types/jsonfile": "npm:*" + "@types/node": "npm:*" + checksum: 10/acc4c1eb0cde7b1f23f3fe6eb080a14832d8fa9dc1761aa444c5e2f0f6b6fa657ed46ebae32fb580a6700fc921b6165ce8ac3e3ba030c3dd15f10ad4dd4cae98 + languageName: node + linkType: hard + "@types/glob@npm:^7.1.1": version: 7.1.3 resolution: "@types/glob@npm:7.1.3" @@ -1812,6 +1847,15 @@ __metadata: languageName: node linkType: hard +"@types/jsonfile@npm:*": + version: 6.1.4 + resolution: "@types/jsonfile@npm:6.1.4" + dependencies: + "@types/node": "npm:*" + checksum: 10/309fda20eb5f1cf68f2df28931afdf189c5e7e6bec64ac783ce737bb98908d57f6f58757ad5da9be37b815645a6f914e2d4f3ac66c574b8fe1ba6616284d0e97 + languageName: node + linkType: hard + "@types/keyv@npm:^3.1.4": version: 3.1.4 resolution: "@types/keyv@npm:3.1.4" @@ -1842,6 +1886,16 @@ __metadata: languageName: node linkType: hard +"@types/node-fetch@npm:^2.6.12": + version: 2.6.12 + resolution: "@types/node-fetch@npm:2.6.12" + dependencies: + "@types/node": "npm:*" + form-data: "npm:^4.0.0" + checksum: 10/8107c479da83a3114fcbfa882eba95ee5175cccb5e4dd53f737a96f2559ae6262f662176b8457c1656de09ec393cc7b20a266c077e4bfb21e929976e1cf4d0f9 + languageName: node + linkType: hard + "@types/node@npm:*, @types/node@npm:>=12.0.0": version: 22.13.1 resolution: "@types/node@npm:22.13.1" @@ -2390,6 +2444,13 @@ __metadata: languageName: node linkType: hard +"async-lock@npm:^1.4.1": + version: 1.4.1 + resolution: "async-lock@npm:1.4.1" + checksum: 10/80d55ac95f920e880a865968b799963014f6d987dd790dd08173fae6e1af509d8cd0ab45a25daaca82e3ef8e7c939f5d128cd1facfcc5c647da8ac2409e20ef9 + languageName: node + linkType: hard + "asynckit@npm:^0.4.0": version: 0.4.0 resolution: "asynckit@npm:0.4.0" @@ -2406,12 +2467,14 @@ __metadata: languageName: node linkType: hard -"axios@npm:^0.24.0": - version: 0.24.0 - resolution: "axios@npm:0.24.0" +"axios@npm:*, axios@npm:^1.8.3": + version: 1.8.3 + resolution: "axios@npm:1.8.3" dependencies: - follow-redirects: "npm:^1.14.4" - checksum: 10/4c5a7a5a45c909b4ce73fbf54b1fbc52a2290fc37cc51e64f8ef2ba8ac5f76a2e369a08ddfd7ec50317528d5aa55f5987cc56fb320923ef87e1b87f8ff05b5ba + follow-redirects: "npm:^1.15.6" + form-data: "npm:^4.0.0" + proxy-from-env: "npm:^1.1.0" + checksum: 10/050f911cadd6d47a38ddbf91d2f8da2c34661dda8077e7ad6546e8178701125366fddbba07211a648b6815cf6c2c3c91c0a65d8b968e3d1a6054a21141ff9c01 languageName: node linkType: hard @@ -2813,6 +2876,18 @@ __metadata: languageName: node linkType: hard +"changelog-parser@npm:3.0.1": + version: 3.0.1 + resolution: "changelog-parser@npm:3.0.1" + dependencies: + line-reader: "npm:^0.2.4" + remove-markdown: "npm:^0.5.0" + bin: + changelog-parser: bin/cli.js + checksum: 10/681c10f43aaa02eb4706a4b883d464fee499dc1dfee679fb9414155b1c3a935126b97d2d0092f07ff62cbe431cf5926a4636856446ff40338ecc20b235ed2692 + languageName: node + linkType: hard + "char-regex@npm:^1.0.2": version: 1.0.2 resolution: "char-regex@npm:1.0.2" @@ -2860,6 +2935,13 @@ __metadata: languageName: node linkType: hard +"clean-git-ref@npm:^2.0.1": + version: 2.0.1 + resolution: "clean-git-ref@npm:2.0.1" + checksum: 10/b25f585ed47040ea5d699d40a2bb84d1f35afd651f3fcc05fb077224358ffd3d7509fc9edbfc4570f1fc732c987e03ac7d8ec31524ac503ac35c53cb1f5e3bf9 + languageName: node + linkType: hard + "clean-stack@npm:^2.0.0": version: 2.2.0 resolution: "clean-stack@npm:2.2.0" @@ -3110,6 +3192,13 @@ __metadata: languageName: node linkType: hard +"data-uri-to-buffer@npm:^4.0.0": + version: 4.0.1 + resolution: "data-uri-to-buffer@npm:4.0.1" + checksum: 10/0d0790b67ffec5302f204c2ccca4494f70b4e2d940fea3d36b09f0bb2b8539c2e86690429eb1f1dc4bcc9e4df0644193073e63d9ee48ac9fce79ec1506e4aa4c + languageName: node + linkType: hard + "debug@npm:4, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.2.0, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4, debug@npm:^4.3.5": version: 4.4.0 resolution: "debug@npm:4.4.0" @@ -3287,6 +3376,13 @@ __metadata: languageName: node linkType: hard +"diff3@npm:0.0.3": + version: 0.0.3 + resolution: "diff3@npm:0.0.3" + checksum: 10/9fb9983052e35209be1912c6999ee4aa1887365666ea28d5aba364ffe8514e0a745a4408a3702b5c5943e717571dcc892073b8f3b48fed5814e2c7fc1883f74e + languageName: node + linkType: hard + "diff@npm:^4.0.1": version: 4.0.2 resolution: "diff@npm:4.0.2" @@ -3294,6 +3390,13 @@ __metadata: languageName: node linkType: hard +"diff@npm:^7.0.0": + version: 7.0.0 + resolution: "diff@npm:7.0.0" + checksum: 10/e9b8e48d054c9c0c093c65ce8e2637af94b35f2427001607b14e5e0589e534ea3413a7f91ebe6d7c5a1494ace49cb7c7c3972f442ddd96a4767ff091999a082e + languageName: node + linkType: hard + "dir-glob@npm:^3.0.1": version: 3.0.1 resolution: "dir-glob@npm:3.0.1" @@ -4036,6 +4139,16 @@ __metadata: languageName: node linkType: hard +"fetch-blob@npm:^3.1.2, fetch-blob@npm:^3.1.4": + version: 3.2.0 + resolution: "fetch-blob@npm:3.2.0" + dependencies: + node-domexception: "npm:^1.0.0" + web-streams-polyfill: "npm:^3.0.3" + checksum: 10/5264ecceb5fdc19eb51d1d0359921f12730941e333019e673e71eb73921146dceabcb0b8f534582be4497312d656508a439ad0f5edeec2b29ab2e10c72a1f86b + languageName: node + linkType: hard + "file-entry-cache@npm:^6.0.1": version: 6.0.1 resolution: "file-entry-cache@npm:6.0.1" @@ -4129,7 +4242,7 @@ __metadata: languageName: node linkType: hard -"follow-redirects@npm:^1.14.4, follow-redirects@npm:^1.15.6": +"follow-redirects@npm:^1.15.6": version: 1.15.9 resolution: "follow-redirects@npm:1.15.9" peerDependenciesMeta: @@ -4171,6 +4284,26 @@ __metadata: languageName: node linkType: hard +"formdata-polyfill@npm:^4.0.10": + version: 4.0.10 + resolution: "formdata-polyfill@npm:4.0.10" + dependencies: + fetch-blob: "npm:^3.1.2" + checksum: 10/9b5001d2edef3c9449ac3f48bd4f8cc92e7d0f2e7c1a5c8ba555ad4e77535cc5cf621fabe49e97f304067037282dd9093b9160a3cb533e46420b446c4e6bc06f + languageName: node + linkType: hard + +"fs-extra@npm:11.3.0": + version: 11.3.0 + resolution: "fs-extra@npm:11.3.0" + dependencies: + graceful-fs: "npm:^4.2.0" + jsonfile: "npm:^6.0.1" + universalify: "npm:^2.0.0" + checksum: 10/c9fe7b23dded1efe7bbae528d685c3206477e20cc60e9aaceb3f024f9b9ff2ee1f62413c161cb88546cc564009ab516dec99e9781ba782d869bb37e4fe04a97f + languageName: node + linkType: hard + "fs-minipass@npm:^2.0.0, fs-minipass@npm:^2.1.0": version: 2.1.0 resolution: "fs-minipass@npm:2.1.0" @@ -4532,6 +4665,13 @@ __metadata: languageName: node linkType: hard +"graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.2.0": + version: 4.2.11 + resolution: "graceful-fs@npm:4.2.11" + checksum: 10/bf152d0ed1dc159239db1ba1f74fdbc40cb02f626770dcd5815c427ce0688c2635a06ed69af364396da4636d0408fcf7d4afdf7881724c3307e46aff30ca49e2 + languageName: node + linkType: hard + "graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9": version: 4.2.10 resolution: "graceful-fs@npm:4.2.10" @@ -4728,6 +4868,13 @@ __metadata: languageName: node linkType: hard +"ignore@npm:^5.1.4": + version: 5.3.2 + resolution: "ignore@npm:5.3.2" + checksum: 10/cceb6a457000f8f6a50e1196429750d782afce5680dd878aa4221bd79972d68b3a55b4b1458fc682be978f4d3c6a249046aa0880637367216444ab7b014cfc98 + languageName: node + linkType: hard + "immutable@npm:^4.0.0": version: 4.1.0 resolution: "immutable@npm:4.1.0" @@ -4788,7 +4935,7 @@ __metadata: languageName: node linkType: hard -"inherits@npm:2, inherits@npm:^2.0.3, inherits@npm:^2.0.4": +"inherits@npm:2, inherits@npm:^2.0.1, inherits@npm:^2.0.3, inherits@npm:^2.0.4": version: 2.0.4 resolution: "inherits@npm:2.0.4" checksum: 10/cd45e923bee15186c07fa4c89db0aace24824c482fb887b528304694b2aa6ff8a898da8657046a5dcf3e46cd6db6c61629551f9215f208d7c3f157cf9b290521 @@ -5083,6 +5230,28 @@ __metadata: languageName: node linkType: hard +"isomorphic-git@npm:1.29.0": + version: 1.29.0 + resolution: "isomorphic-git@npm:1.29.0" + dependencies: + async-lock: "npm:^1.4.1" + clean-git-ref: "npm:^2.0.1" + crc-32: "npm:^1.2.0" + diff3: "npm:0.0.3" + ignore: "npm:^5.1.4" + minimisted: "npm:^2.0.0" + pako: "npm:^1.0.10" + path-browserify: "npm:^1.0.1" + pify: "npm:^4.0.1" + readable-stream: "npm:^3.4.0" + sha.js: "npm:^2.4.9" + simple-get: "npm:^4.0.1" + bin: + isogit: cli.cjs + checksum: 10/d9a7ec608bc6a374019018fa9116a10c7dd5148317ccbc1d76524d3fda4146c8eac4eb4120a602333849e0d390d229843adb4e926faf641ead60b016a611f5cf + languageName: node + linkType: hard + "istanbul-lib-coverage@npm:^3.0.0, istanbul-lib-coverage@npm:^3.2.0": version: 3.2.0 resolution: "istanbul-lib-coverage@npm:3.2.0" @@ -5704,6 +5873,19 @@ __metadata: languageName: node linkType: hard +"jsonfile@npm:^6.0.1": + version: 6.1.0 + resolution: "jsonfile@npm:6.1.0" + dependencies: + graceful-fs: "npm:^4.1.6" + universalify: "npm:^2.0.0" + dependenciesMeta: + graceful-fs: + optional: true + checksum: 10/03014769e7dc77d4cf05fa0b534907270b60890085dd5e4d60a382ff09328580651da0b8b4cdf44d91e4c8ae64d91791d965f05707beff000ed494a38b6fec85 + languageName: node + linkType: hard + "jwa@npm:^2.0.0": version: 2.0.0 resolution: "jwa@npm:2.0.0" @@ -5758,6 +5940,13 @@ __metadata: languageName: node linkType: hard +"line-reader@npm:^0.2.4": + version: 0.2.4 + resolution: "line-reader@npm:0.2.4" + checksum: 10/62ea55882df41938b5a5d93cfa4fdc06d263b206d7b97b0b9a1ddb10b0907debd36770931fd788c233ffcff724fd67ec15444f1f4c62e229fd8eb684991a6c62 + languageName: node + linkType: hard + "lines-and-columns@npm:^1.1.6": version: 1.1.6 resolution: "lines-and-columns@npm:1.1.6" @@ -6023,6 +6212,22 @@ __metadata: languageName: node linkType: hard +"minimist@npm:^1.2.5": + version: 1.2.8 + resolution: "minimist@npm:1.2.8" + checksum: 10/908491b6cc15a6c440ba5b22780a0ba89b9810e1aea684e253e43c4e3b8d56ec1dcdd7ea96dde119c29df59c936cde16062159eae4225c691e19c70b432b6e6f + languageName: node + linkType: hard + +"minimisted@npm:^2.0.0": + version: 2.0.1 + resolution: "minimisted@npm:2.0.1" + dependencies: + minimist: "npm:^1.2.5" + checksum: 10/f8c81346b1f535c0be173f4937991586ec86e55b7c94790000d1cba436053ed6a536d290321194b45512a8fa0e30678fd10c759e82ce5388c2dbe4f990b4a9ec + languageName: node + linkType: hard + "minipass-collect@npm:^1.0.2": version: 1.0.2 resolution: "minipass-collect@npm:1.0.2" @@ -6166,6 +6371,13 @@ __metadata: languageName: node linkType: hard +"node-domexception@npm:^1.0.0": + version: 1.0.0 + resolution: "node-domexception@npm:1.0.0" + checksum: 10/e332522f242348c511640c25a6fc7da4f30e09e580c70c6b13cb0be83c78c3e71c8d4665af2527e869fc96848924a4316ae7ec9014c091e2156f41739d4fa233 + languageName: node + linkType: hard + "node-fetch@npm:^2.6.7, node-fetch@npm:^2.6.9": version: 2.7.0 resolution: "node-fetch@npm:2.7.0" @@ -6180,6 +6392,17 @@ __metadata: languageName: node linkType: hard +"node-fetch@npm:^3.3.2": + version: 3.3.2 + resolution: "node-fetch@npm:3.3.2" + dependencies: + data-uri-to-buffer: "npm:^4.0.0" + fetch-blob: "npm:^3.1.4" + formdata-polyfill: "npm:^4.0.10" + checksum: 10/24207ca8c81231c7c59151840e3fded461d67a31cf3e3b3968e12201a42f89ce4a0b5fb7079b1fa0a4655957b1ca9257553200f03a9f668b45ebad265ca5593d + languageName: node + linkType: hard + "node-gyp@npm:^9.0.0": version: 9.3.1 resolution: "node-gyp@npm:9.3.1" @@ -6520,6 +6743,13 @@ __metadata: languageName: node linkType: hard +"pako@npm:^1.0.10": + version: 1.0.11 + resolution: "pako@npm:1.0.11" + checksum: 10/1ad07210e894472685564c4d39a08717e84c2a68a70d3c1d9e657d32394ef1670e22972a433cbfe48976cb98b154ba06855dcd3fcfba77f60f1777634bec48c0 + languageName: node + linkType: hard + "parent-module@npm:^1.0.0": version: 1.0.1 resolution: "parent-module@npm:1.0.1" @@ -6541,6 +6771,13 @@ __metadata: languageName: node linkType: hard +"path-browserify@npm:^1.0.1": + version: 1.0.1 + resolution: "path-browserify@npm:1.0.1" + checksum: 10/7e7368a5207e7c6b9051ef045711d0dc3c2b6203e96057e408e6e74d09f383061010d2be95cb8593fe6258a767c3e9fc6b2bfc7ce8d48ae8c3d9f6994cca9ad8 + languageName: node + linkType: hard + "path-exists@npm:^4.0.0": version: 4.0.0 resolution: "path-exists@npm:4.0.0" @@ -6611,6 +6848,13 @@ __metadata: languageName: node linkType: hard +"pify@npm:^4.0.1": + version: 4.0.1 + resolution: "pify@npm:4.0.1" + checksum: 10/8b97cbf9dc6d4c1320cc238a2db0fc67547f9dc77011729ff353faf34f1936ea1a4d7f3c63b2f4980b253be77bcc72ea1e9e76ee3fd53cce2aafb6a8854d07ec + languageName: node + linkType: hard + "pirates@npm:^4.0.4": version: 4.0.5 resolution: "pirates@npm:4.0.5" @@ -6867,6 +7111,13 @@ __metadata: languageName: node linkType: hard +"remove-markdown@npm:^0.5.0": + version: 0.5.5 + resolution: "remove-markdown@npm:0.5.5" + checksum: 10/0cb77c70ea64565ee9cfcb2f447782a02ef27885b8d131c027064f6313f9770da4ec837c53c9461cec7a13c4df50078b2544e89655bd6d4a98d50571df84c38f + languageName: node + linkType: hard + "require-directory@npm:^2.1.1": version: 2.1.1 resolution: "require-directory@npm:2.1.1" @@ -7142,6 +7393,18 @@ __metadata: languageName: node linkType: hard +"sha.js@npm:^2.4.9": + version: 2.4.11 + resolution: "sha.js@npm:2.4.11" + dependencies: + inherits: "npm:^2.0.1" + safe-buffer: "npm:^5.0.1" + bin: + sha.js: ./bin.js + checksum: 10/d833bfa3e0a67579a6ce6e1bc95571f05246e0a441dd8c76e3057972f2a3e098465687a4369b07e83a0375a88703577f71b5b2e966809e67ebc340dbedb478c7 + languageName: node + linkType: hard + "shebang-command@npm:^1.2.0": version: 1.2.0 resolution: "shebang-command@npm:1.2.0" @@ -7236,6 +7499,24 @@ __metadata: languageName: node linkType: hard +"simple-concat@npm:^1.0.0": + version: 1.0.1 + resolution: "simple-concat@npm:1.0.1" + checksum: 10/4d211042cc3d73a718c21ac6c4e7d7a0363e184be6a5ad25c8a1502e49df6d0a0253979e3d50dbdd3f60ef6c6c58d756b5d66ac1e05cda9cacd2e9fc59e3876a + languageName: node + linkType: hard + +"simple-get@npm:^4.0.1": + version: 4.0.1 + resolution: "simple-get@npm:4.0.1" + dependencies: + decompress-response: "npm:^6.0.0" + once: "npm:^1.3.1" + simple-concat: "npm:^1.0.0" + checksum: 10/93f1b32319782f78f2f2234e9ce34891b7ab6b990d19d8afefaa44423f5235ce2676aae42d6743fecac6c8dfff4b808d4c24fe5265be813d04769917a9a44f36 + languageName: node + linkType: hard + "simple-git@npm:3.27.0": version: 3.27.0 resolution: "simple-git@npm:3.27.0" @@ -7932,6 +8213,13 @@ __metadata: languageName: node linkType: hard +"universalify@npm:^2.0.0": + version: 2.0.1 + resolution: "universalify@npm:2.0.1" + checksum: 10/ecd8469fe0db28e7de9e5289d32bd1b6ba8f7183db34f3bfc4ca53c49891c2d6aa05f3fb3936a81285a905cc509fb641a0c3fc131ec786167eff41236ae32e60 + languageName: node + linkType: hard + "update-browserslist-db@npm:^1.0.5": version: 1.0.5 resolution: "update-browserslist-db@npm:1.0.5" @@ -8014,6 +8302,13 @@ __metadata: languageName: node linkType: hard +"web-streams-polyfill@npm:^3.0.3": + version: 3.3.3 + resolution: "web-streams-polyfill@npm:3.3.3" + checksum: 10/8e7e13501b3834094a50abe7c0b6456155a55d7571312b89570012ef47ec2a46d766934768c50aabad10a9c30dd764a407623e8bfcc74fcb58495c29130edea9 + languageName: node + linkType: hard + "webidl-conversions@npm:^3.0.0": version: 3.0.1 resolution: "webidl-conversions@npm:3.0.1" From f94591b74a35f60b775a03730d468970e9c87859 Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Thu, 13 Mar 2025 15:29:32 -0500 Subject: [PATCH 05/41] remove pr number arg --- .github/workflows/changelog-check.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index 2d87d416..133866f8 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -3,9 +3,6 @@ name: Changelog Check on: workflow_call: inputs: - pr-number: - required: true - type: string base-branch: required: true type: string From 0e2c3dd98bf6c0f5863827c98e317536fb977f41 Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Thu, 13 Mar 2025 15:34:31 -0500 Subject: [PATCH 06/41] script updates --- .github/workflows/changelog-check.yml | 4 ++-- src/changelog-check.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index 133866f8..56e02519 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -44,10 +44,10 @@ jobs: # Step 4: Run Script - name: Check Changelog - id: check-changelog + id: changelog-check shell: bash env: GITHUB_TOKEN: ${{ secrets.gh-token }} working-directory: ./github-tools run: | - yarn run check-changelog ${{ github.repository }} ${{ inputs.base-branch }} ${{ inputs.feature-branch }} \ No newline at end of file + yarn run changelog-check ${{ github.repository }} ${{ inputs.base-branch }} ${{ inputs.feature-branch }} \ No newline at end of file diff --git a/src/changelog-check.ts b/src/changelog-check.ts index 557e1507..0211ef89 100644 --- a/src/changelog-check.ts +++ b/src/changelog-check.ts @@ -25,7 +25,7 @@ const repoPath = process.cwd(); // Root directory for any temp storage // Function to fetch the raw file content from GitHub async function fetchChangelogFromGitHub(repo: string, branch: string): Promise { // Use raw.githubusercontent.com to directly fetch file content - const url = `https://raw.githubusercontent.com/MetaMask/${repo}/${branch}/CHANGELOG.md`; + const url = `https://raw.githubusercontent.com/${repo}/${branch}/CHANGELOG.md`; const token = process.env.GITHUB_TOKEN || ""; try { From cc3acd82e84fcdea0a9a42d47fa69f699e847226 Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Thu, 13 Mar 2025 15:47:46 -0500 Subject: [PATCH 07/41] fmt --- src/changelog-check.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/changelog-check.ts b/src/changelog-check.ts index 0211ef89..5be0d1e8 100644 --- a/src/changelog-check.ts +++ b/src/changelog-check.ts @@ -83,17 +83,17 @@ differences.forEach(part => { console.log("🔍 Diff between base and feature '[Unreleased]' sections:"); if (removedLines.length > 0) { - console.log("\x1b[31m❌ Removed:\x1b[0m"); - removedLines.forEach(line => console.log(`\x1b[31m- ${line}\x1b[0m`)); + console.log("❌ Removed:"); + removedLines.forEach(line => console.log(`${line}`)); } else { - console.log("\x1b[31m❌ No removed lines.\x1b[0m"); + console.log("❌ No removed lines."); } if (addedLines.length > 0) { - console.log("\x1b[32m✅ Added:\x1b[0m"); - addedLines.forEach(line => console.log(`\x1b[32m+ ${line}\x1b[0m`)); + console.log("✅ Added:"); + addedLines.forEach(line => console.log(`${line}`)); } else { - console.log("\x1b[32m✅ No added lines.\x1b[0m"); + console.log("✅ No added lines."); } } From a2325bf1b7e39a144d22c3e329384bf001f4e6ee Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Thu, 13 Mar 2025 16:48:00 -0500 Subject: [PATCH 08/41] lint --- .github/workflows/changelog-check.yml | 2 +- package.json | 4 +- src/changelog-check.ts | 272 +++++++++++++++----------- 3 files changed, 162 insertions(+), 116 deletions(-) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index 56e02519..c7d50da2 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -50,4 +50,4 @@ jobs: GITHUB_TOKEN: ${{ secrets.gh-token }} working-directory: ./github-tools run: | - yarn run changelog-check ${{ github.repository }} ${{ inputs.base-branch }} ${{ inputs.feature-branch }} \ No newline at end of file + yarn run changelog-check ${{ github.repository }} ${{ inputs.base-branch }} ${{ inputs.feature-branch }} diff --git a/package.json b/package.json index 22103de4..11c232f4 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "private": true, "description": "Tools for interacting with the GitHub API to do metrics gathering", "scripts": { + "changelog-check": "ts-node src/changelog-check.ts", "count-references-to-contributor-docs": "ts-node --swc src/scripts/count-references-to-contributor-docs/cli.ts", "gen:commits": "node .github/scripts/generate-rc-commits.mjs", "get-review-metrics": "ts-node src/get-review-metrics.ts", @@ -17,8 +18,7 @@ "slack:release-testing": "node .github/scripts/slack-release-testing.mjs", "test": "jest && jest-it-up", "test:watch": "jest --watch", - "update-release-sheet": "node .github/scripts/update-release-sheet.mjs", - "changelog-check": "ts-node src/changelog-check.ts" + "update-release-sheet": "node .github/scripts/update-release-sheet.mjs" }, "dependencies": { "@metamask/utils": "^7.1.0", diff --git a/src/changelog-check.ts b/src/changelog-check.ts index 5be0d1e8..e616d3eb 100644 --- a/src/changelog-check.ts +++ b/src/changelog-check.ts @@ -1,154 +1,200 @@ -import { diffLines } from "diff"; // Import diff library -import axios from "axios"; +import axios from 'axios'; +import { diffLines } from 'diff'; // Import diff library // Manually define types for changelog-parser since it lacks official TypeScript support -interface Release { - version: string | null; - title: string; - date: string | null; - body: string; - parsed: Record; +type Release = { + version: string | null; + title: string; + date: string | null; + body: string; + parsed: Record; +}; + +type Changelog = { + title: string; + description: string; + versions: Release[]; +}; + +const changelogParser: (options: { + filePath?: string; + text?: string; + // eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires +}) => Promise = require('changelog-parser'); + +/** + * Asynchronously fetches the CHANGELOG.md file content from a specified GitHub repository and branch. + * The function constructs a URL to access the raw content of the file using GitHub's raw content service. + * It handles authorization using an optional GitHub token from environment variables. + * + * @param repo - The full name of the repository (e.g., "owner/repo"). + * @param branch - The branch from which to fetch the CHANGELOG.md file. + * @returns A promise that resolves to the content of the CHANGELOG.md file as a string. + * If the fetch operation fails, it logs an error and returns an empty string. + */ +async function fetchChangelogFromGitHub( + repo: string, + branch: string, +): Promise { + // Use raw.githubusercontent.com to directly fetch file content + const url = `https://raw.githubusercontent.com/${repo}/${branch}/CHANGELOG.md`; + // eslint-disable-next-line n/no-process-env + const token = process.env.GITHUB_TOKEN ?? ''; + + try { + const response = await axios.get(url, { + headers: token ? { Authorization: `Bearer ${token}` } : {}, + responseType: 'text', // Ensure we get raw text + }); + + return response.data; // Directly return the raw content + } catch (error) { + console.error( + `❌ Error fetching CHANGELOG.md from ${branch} on ${repo}:`, + error, + ); + return ''; } - - interface Changelog { - title: string; - description: string; - versions: Release[]; - } - - // Import changelog-parser as an untyped module - const changelogParser: (options: { filePath?: string; text?: string }) => Promise = require("changelog-parser"); - - -const repoPath = process.cwd(); // Root directory for any temp storage - -// Function to fetch the raw file content from GitHub -async function fetchChangelogFromGitHub(repo: string, branch: string): Promise { - // Use raw.githubusercontent.com to directly fetch file content - const url = `https://raw.githubusercontent.com/${repo}/${branch}/CHANGELOG.md`; - const token = process.env.GITHUB_TOKEN || ""; - - try { - const response = await axios.get(url, { - headers: token ? { Authorization: `Bearer ${token}` } : {}, - responseType: "text", // Ensure we get raw text - }); - - return response.data; // Directly return the raw content - } catch (error) { - console.error(`❌ Error fetching CHANGELOG.md from ${branch} on ${repo}:`, error); - return ""; - } } -// Function to parse the changelog and extract "Unreleased" section +/** + * Parses the content of a CHANGELOG.md file to extract the section marked as "[Unreleased]". + * @param content - The raw markdown content of the CHANGELOG.md file to be parsed. + * @returns A promise that resolves to the markdown content of the "[Unreleased]" section, + * or an empty string if the section is not found or an error occurs. + */ async function parseChangelog(content: string): Promise { - try { - const parsed: Changelog = await changelogParser({ text: content }); - - // Try to find the "[Unreleased]" section - const unreleasedSection = parsed.versions.find(v => v.title.trim().toLowerCase() === "[unreleased]"); - - if (!unreleasedSection) { - console.warn("⚠️ '[Unreleased]' section not found! Check the formatting in CHANGELOG.md."); - return ""; - } - - return unreleasedSection.body - - } catch (error) { - console.error("❌ Error parsing CHANGELOG.md:", error); - return ""; + try { + const parsed: Changelog = await changelogParser({ text: content }); + + // Try to find the "[Unreleased]" section + const unreleasedSection = parsed.versions.find( + (ver) => ver.title.trim().toLowerCase() === '[unreleased]', + ); + + if (!unreleasedSection) { + console.warn( + "⚠️ '[Unreleased]' section not found! Check the formatting in CHANGELOG.md.", + ); + return ''; } + + return unreleasedSection.body; + } catch (error) { + console.error('❌ Error parsing CHANGELOG.md:', error); + return ''; + } } +/** + * Displays the differences between two sets of changelog entries. + * @param baseChanges - The content of the '[Unreleased]' section from the base branch's CHANGELOG.md. + * @param featureChanges - The content of the '[Unreleased]' section from the feature branch's CHANGELOG.md. + */ function displayDiff(baseChanges: string, featureChanges: string) { + // Compute the line-by-line differences + const differences = diffLines(baseChanges, featureChanges); - // Compute the line-by-line differences -const differences = diffLines(baseChanges, featureChanges); - -const addedLines: string[] = []; -const removedLines: string[] = []; + const addedLines: string[] = []; + const removedLines: string[] = []; -// Collect added and removed lines into separate lists -differences.forEach(part => { + // Collect added and removed lines into separate lists + differences.forEach((part) => { if (part.added) { - addedLines.push(part.value.trim()); // Trim to remove leading/trailing spaces + addedLines.push(part.value.trim()); // Trim to remove leading/trailing spaces } else if (part.removed) { - removedLines.push(part.value.trim()); + removedLines.push(part.value.trim()); } -}); + }); -// Print the diff summary -console.log("🔍 Diff between base and feature '[Unreleased]' sections:"); + // Print the diff summary + console.log("🔍 Diff between base and feature '[Unreleased]' sections:"); -if (removedLines.length > 0) { - console.log("❌ Removed:"); - removedLines.forEach(line => console.log(`${line}`)); -} else { - console.log("❌ No removed lines."); -} - -if (addedLines.length > 0) { - console.log("✅ Added:"); - addedLines.forEach(line => console.log(`${line}`)); -} else { - console.log("✅ No added lines."); -} + if (removedLines.length > 0) { + console.log('❌ Removed:'); + removedLines.forEach((line) => console.log(`${line}`)); + } else { + console.log('❌ No removed lines.'); + } + if (addedLines.length > 0) { + console.log('✅ Added:'); + addedLines.forEach((line) => console.log(`${line}`)); + } else { + console.log('✅ No added lines.'); + } } -// Main function to validate the changelog -async function validateChangelog(repo: string, baseBranch: string, featureBranch: string) { - console.log(`🔍 Fetching CHANGELOG.md from GitHub repository: ${repo}`); - - // Fetch CHANGELOG.md from both branches - const baseChangelogContent = await fetchChangelogFromGitHub(repo, baseBranch); - const featureChangelogContent = await fetchChangelogFromGitHub(repo, featureBranch); - - if (!featureChangelogContent) { - console.log("❌ CHANGELOG.md is missing in the feature branch."); - process.exit(1); - } +/** + * Validates that the CHANGELOG.md in a feature branch has been updated correctly by comparing it + * against the CHANGELOG.md in the base branch. + * @param repo - The GitHub repository from which to fetch the CHANGELOG.md file. + * @param baseBranch - The base branch (typically 'main' or 'master') to compare against. + * @param featureBranch - The feature branch that should contain the updated CHANGELOG.md. + */ +async function validateChangelog( + repo: string, + baseBranch: string, + featureBranch: string, +) { + console.log(`🔍 Fetching CHANGELOG.md from GitHub repository: ${repo}`); + + // Fetch CHANGELOG.md from both branches + const baseChangelogContent = await fetchChangelogFromGitHub(repo, baseBranch); + const featureChangelogContent = await fetchChangelogFromGitHub( + repo, + featureBranch, + ); + + if (!featureChangelogContent) { + console.error('❌ CHANGELOG.md is missing in the feature branch.'); + throw new Error('❌ CHANGELOG.md is missing in the feature branch.'); + } - // Parse the changelogs - const baseChanges = await parseChangelog(baseChangelogContent); - const featureChanges = await parseChangelog(featureChangelogContent); + // Parse the changelogs + const baseChanges = await parseChangelog(baseChangelogContent); + const featureChanges = await parseChangelog(featureChangelogContent); - console.log("🔍 Comparing changelog entries..."); + console.log('🔍 Comparing changelog entries...'); - console.log("Base unreleased section:", baseChanges); - console.log("Feature unreleased section:", featureChanges); + console.log('Base unreleased section:', baseChanges); + console.log('Feature unreleased section:', featureChanges); - displayDiff(baseChanges, featureChanges); + displayDiff(baseChanges, featureChanges); - if (baseChanges === featureChanges) { - console.log("❌ No new entries detected under '## Unreleased'. Please update the changelog."); - process.exit(1); - } + if (baseChanges === featureChanges) { + console.log( + "❌ No new entries detected under '## Unreleased'. Please update the changelog.", + ); + throw new Error( + "❌ No new entries detected under '## Unreleased'. Please update the changelog.", + ); + } - console.log("✅ CHANGELOG.md has been correctly updated."); - process.exit(0); + console.log('✅ CHANGELOG.md has been correctly updated.'); } // Parse command-line arguments const args = process.argv.slice(2); if (args.length < 3) { - console.error("❌ Usage: node scripts/check-changelog.js "); - process.exit(1); + console.error( + '❌ Usage: node scripts/check-changelog.js ', + ); + throw new Error('❌ Missing required arguments.'); } const [githubRepo, baseBranch, featureBranch] = args; // Ensure all required arguments are provided if (!githubRepo || !baseBranch || !featureBranch) { - console.error("❌ Error: Missing required arguments."); - console.error("✅ Usage: node scripts/check-changelog.js "); - process.exit(1); + console.error( + '✅ Usage: ts-node scripts/check-changelog.ts ', + ); + throw new Error('❌ Missing required arguments.'); } // Run the validation -validateChangelog(githubRepo, baseBranch, featureBranch).catch(error => { - console.error("❌ Unexpected error:", error); - process.exit(1); +validateChangelog(githubRepo, baseBranch, featureBranch).catch((error) => { + console.error('❌ Unexpected error:', error); + throw error; }); From 8c3846a88d7a6b3cf3c4a9c7c732aa48c8519ebc Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Fri, 14 Mar 2025 11:26:18 -0500 Subject: [PATCH 09/41] remove un-used dependencies --- package.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/package.json b/package.json index 11c232f4..c3d3bb74 100644 --- a/package.json +++ b/package.json @@ -31,11 +31,8 @@ "changelog-parser": "3.0.1", "csv-parse": "5.6.0", "diff": "^7.0.0", - "fs-extra": "11.3.0", "googleapis": "144.0.0", - "isomorphic-git": "1.29.0", "luxon": "^3.3.0", - "node-fetch": "^3.3.2", "ora": "^5.4.1", "simple-git": "3.27.0" }, From 2c7bbae9cf23d2c7b25f85effd1f8e3bf97f2e26 Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Fri, 14 Mar 2025 11:31:00 -0500 Subject: [PATCH 10/41] yarn.lock --- yarn.lock | 211 +----------------------------------------------------- 1 file changed, 1 insertion(+), 210 deletions(-) diff --git a/yarn.lock b/yarn.lock index 1ab5629d..a1e6ab2e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1030,13 +1030,10 @@ __metadata: eslint-plugin-n: "npm:^15.7.0" eslint-plugin-prettier: "npm:^4.2.1" eslint-plugin-promise: "npm:^6.1.1" - fs-extra: "npm:11.3.0" googleapis: "npm:144.0.0" - isomorphic-git: "npm:1.29.0" jest: "npm:^28.1.3" jest-it-up: "npm:^2.0.2" luxon: "npm:^3.3.0" - node-fetch: "npm:^3.3.2" ora: "npm:^5.4.1" prettier: "npm:^2.7.1" prettier-plugin-packagejson: "npm:^2.3.0" @@ -2444,13 +2441,6 @@ __metadata: languageName: node linkType: hard -"async-lock@npm:^1.4.1": - version: 1.4.1 - resolution: "async-lock@npm:1.4.1" - checksum: 10/80d55ac95f920e880a865968b799963014f6d987dd790dd08173fae6e1af509d8cd0ab45a25daaca82e3ef8e7c939f5d128cd1facfcc5c647da8ac2409e20ef9 - languageName: node - linkType: hard - "asynckit@npm:^0.4.0": version: 0.4.0 resolution: "asynckit@npm:0.4.0" @@ -2935,13 +2925,6 @@ __metadata: languageName: node linkType: hard -"clean-git-ref@npm:^2.0.1": - version: 2.0.1 - resolution: "clean-git-ref@npm:2.0.1" - checksum: 10/b25f585ed47040ea5d699d40a2bb84d1f35afd651f3fcc05fb077224358ffd3d7509fc9edbfc4570f1fc732c987e03ac7d8ec31524ac503ac35c53cb1f5e3bf9 - languageName: node - linkType: hard - "clean-stack@npm:^2.0.0": version: 2.2.0 resolution: "clean-stack@npm:2.2.0" @@ -3192,13 +3175,6 @@ __metadata: languageName: node linkType: hard -"data-uri-to-buffer@npm:^4.0.0": - version: 4.0.1 - resolution: "data-uri-to-buffer@npm:4.0.1" - checksum: 10/0d0790b67ffec5302f204c2ccca4494f70b4e2d940fea3d36b09f0bb2b8539c2e86690429eb1f1dc4bcc9e4df0644193073e63d9ee48ac9fce79ec1506e4aa4c - languageName: node - linkType: hard - "debug@npm:4, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.2.0, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4, debug@npm:^4.3.5": version: 4.4.0 resolution: "debug@npm:4.4.0" @@ -3376,13 +3352,6 @@ __metadata: languageName: node linkType: hard -"diff3@npm:0.0.3": - version: 0.0.3 - resolution: "diff3@npm:0.0.3" - checksum: 10/9fb9983052e35209be1912c6999ee4aa1887365666ea28d5aba364ffe8514e0a745a4408a3702b5c5943e717571dcc892073b8f3b48fed5814e2c7fc1883f74e - languageName: node - linkType: hard - "diff@npm:^4.0.1": version: 4.0.2 resolution: "diff@npm:4.0.2" @@ -4139,16 +4108,6 @@ __metadata: languageName: node linkType: hard -"fetch-blob@npm:^3.1.2, fetch-blob@npm:^3.1.4": - version: 3.2.0 - resolution: "fetch-blob@npm:3.2.0" - dependencies: - node-domexception: "npm:^1.0.0" - web-streams-polyfill: "npm:^3.0.3" - checksum: 10/5264ecceb5fdc19eb51d1d0359921f12730941e333019e673e71eb73921146dceabcb0b8f534582be4497312d656508a439ad0f5edeec2b29ab2e10c72a1f86b - languageName: node - linkType: hard - "file-entry-cache@npm:^6.0.1": version: 6.0.1 resolution: "file-entry-cache@npm:6.0.1" @@ -4284,26 +4243,6 @@ __metadata: languageName: node linkType: hard -"formdata-polyfill@npm:^4.0.10": - version: 4.0.10 - resolution: "formdata-polyfill@npm:4.0.10" - dependencies: - fetch-blob: "npm:^3.1.2" - checksum: 10/9b5001d2edef3c9449ac3f48bd4f8cc92e7d0f2e7c1a5c8ba555ad4e77535cc5cf621fabe49e97f304067037282dd9093b9160a3cb533e46420b446c4e6bc06f - languageName: node - linkType: hard - -"fs-extra@npm:11.3.0": - version: 11.3.0 - resolution: "fs-extra@npm:11.3.0" - dependencies: - graceful-fs: "npm:^4.2.0" - jsonfile: "npm:^6.0.1" - universalify: "npm:^2.0.0" - checksum: 10/c9fe7b23dded1efe7bbae528d685c3206477e20cc60e9aaceb3f024f9b9ff2ee1f62413c161cb88546cc564009ab516dec99e9781ba782d869bb37e4fe04a97f - languageName: node - linkType: hard - "fs-minipass@npm:^2.0.0, fs-minipass@npm:^2.1.0": version: 2.1.0 resolution: "fs-minipass@npm:2.1.0" @@ -4665,13 +4604,6 @@ __metadata: languageName: node linkType: hard -"graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.2.0": - version: 4.2.11 - resolution: "graceful-fs@npm:4.2.11" - checksum: 10/bf152d0ed1dc159239db1ba1f74fdbc40cb02f626770dcd5815c427ce0688c2635a06ed69af364396da4636d0408fcf7d4afdf7881724c3307e46aff30ca49e2 - languageName: node - linkType: hard - "graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9": version: 4.2.10 resolution: "graceful-fs@npm:4.2.10" @@ -4868,13 +4800,6 @@ __metadata: languageName: node linkType: hard -"ignore@npm:^5.1.4": - version: 5.3.2 - resolution: "ignore@npm:5.3.2" - checksum: 10/cceb6a457000f8f6a50e1196429750d782afce5680dd878aa4221bd79972d68b3a55b4b1458fc682be978f4d3c6a249046aa0880637367216444ab7b014cfc98 - languageName: node - linkType: hard - "immutable@npm:^4.0.0": version: 4.1.0 resolution: "immutable@npm:4.1.0" @@ -4935,7 +4860,7 @@ __metadata: languageName: node linkType: hard -"inherits@npm:2, inherits@npm:^2.0.1, inherits@npm:^2.0.3, inherits@npm:^2.0.4": +"inherits@npm:2, inherits@npm:^2.0.3, inherits@npm:^2.0.4": version: 2.0.4 resolution: "inherits@npm:2.0.4" checksum: 10/cd45e923bee15186c07fa4c89db0aace24824c482fb887b528304694b2aa6ff8a898da8657046a5dcf3e46cd6db6c61629551f9215f208d7c3f157cf9b290521 @@ -5230,28 +5155,6 @@ __metadata: languageName: node linkType: hard -"isomorphic-git@npm:1.29.0": - version: 1.29.0 - resolution: "isomorphic-git@npm:1.29.0" - dependencies: - async-lock: "npm:^1.4.1" - clean-git-ref: "npm:^2.0.1" - crc-32: "npm:^1.2.0" - diff3: "npm:0.0.3" - ignore: "npm:^5.1.4" - minimisted: "npm:^2.0.0" - pako: "npm:^1.0.10" - path-browserify: "npm:^1.0.1" - pify: "npm:^4.0.1" - readable-stream: "npm:^3.4.0" - sha.js: "npm:^2.4.9" - simple-get: "npm:^4.0.1" - bin: - isogit: cli.cjs - checksum: 10/d9a7ec608bc6a374019018fa9116a10c7dd5148317ccbc1d76524d3fda4146c8eac4eb4120a602333849e0d390d229843adb4e926faf641ead60b016a611f5cf - languageName: node - linkType: hard - "istanbul-lib-coverage@npm:^3.0.0, istanbul-lib-coverage@npm:^3.2.0": version: 3.2.0 resolution: "istanbul-lib-coverage@npm:3.2.0" @@ -5873,19 +5776,6 @@ __metadata: languageName: node linkType: hard -"jsonfile@npm:^6.0.1": - version: 6.1.0 - resolution: "jsonfile@npm:6.1.0" - dependencies: - graceful-fs: "npm:^4.1.6" - universalify: "npm:^2.0.0" - dependenciesMeta: - graceful-fs: - optional: true - checksum: 10/03014769e7dc77d4cf05fa0b534907270b60890085dd5e4d60a382ff09328580651da0b8b4cdf44d91e4c8ae64d91791d965f05707beff000ed494a38b6fec85 - languageName: node - linkType: hard - "jwa@npm:^2.0.0": version: 2.0.0 resolution: "jwa@npm:2.0.0" @@ -6212,22 +6102,6 @@ __metadata: languageName: node linkType: hard -"minimist@npm:^1.2.5": - version: 1.2.8 - resolution: "minimist@npm:1.2.8" - checksum: 10/908491b6cc15a6c440ba5b22780a0ba89b9810e1aea684e253e43c4e3b8d56ec1dcdd7ea96dde119c29df59c936cde16062159eae4225c691e19c70b432b6e6f - languageName: node - linkType: hard - -"minimisted@npm:^2.0.0": - version: 2.0.1 - resolution: "minimisted@npm:2.0.1" - dependencies: - minimist: "npm:^1.2.5" - checksum: 10/f8c81346b1f535c0be173f4937991586ec86e55b7c94790000d1cba436053ed6a536d290321194b45512a8fa0e30678fd10c759e82ce5388c2dbe4f990b4a9ec - languageName: node - linkType: hard - "minipass-collect@npm:^1.0.2": version: 1.0.2 resolution: "minipass-collect@npm:1.0.2" @@ -6371,13 +6245,6 @@ __metadata: languageName: node linkType: hard -"node-domexception@npm:^1.0.0": - version: 1.0.0 - resolution: "node-domexception@npm:1.0.0" - checksum: 10/e332522f242348c511640c25a6fc7da4f30e09e580c70c6b13cb0be83c78c3e71c8d4665af2527e869fc96848924a4316ae7ec9014c091e2156f41739d4fa233 - languageName: node - linkType: hard - "node-fetch@npm:^2.6.7, node-fetch@npm:^2.6.9": version: 2.7.0 resolution: "node-fetch@npm:2.7.0" @@ -6392,17 +6259,6 @@ __metadata: languageName: node linkType: hard -"node-fetch@npm:^3.3.2": - version: 3.3.2 - resolution: "node-fetch@npm:3.3.2" - dependencies: - data-uri-to-buffer: "npm:^4.0.0" - fetch-blob: "npm:^3.1.4" - formdata-polyfill: "npm:^4.0.10" - checksum: 10/24207ca8c81231c7c59151840e3fded461d67a31cf3e3b3968e12201a42f89ce4a0b5fb7079b1fa0a4655957b1ca9257553200f03a9f668b45ebad265ca5593d - languageName: node - linkType: hard - "node-gyp@npm:^9.0.0": version: 9.3.1 resolution: "node-gyp@npm:9.3.1" @@ -6743,13 +6599,6 @@ __metadata: languageName: node linkType: hard -"pako@npm:^1.0.10": - version: 1.0.11 - resolution: "pako@npm:1.0.11" - checksum: 10/1ad07210e894472685564c4d39a08717e84c2a68a70d3c1d9e657d32394ef1670e22972a433cbfe48976cb98b154ba06855dcd3fcfba77f60f1777634bec48c0 - languageName: node - linkType: hard - "parent-module@npm:^1.0.0": version: 1.0.1 resolution: "parent-module@npm:1.0.1" @@ -6771,13 +6620,6 @@ __metadata: languageName: node linkType: hard -"path-browserify@npm:^1.0.1": - version: 1.0.1 - resolution: "path-browserify@npm:1.0.1" - checksum: 10/7e7368a5207e7c6b9051ef045711d0dc3c2b6203e96057e408e6e74d09f383061010d2be95cb8593fe6258a767c3e9fc6b2bfc7ce8d48ae8c3d9f6994cca9ad8 - languageName: node - linkType: hard - "path-exists@npm:^4.0.0": version: 4.0.0 resolution: "path-exists@npm:4.0.0" @@ -6848,13 +6690,6 @@ __metadata: languageName: node linkType: hard -"pify@npm:^4.0.1": - version: 4.0.1 - resolution: "pify@npm:4.0.1" - checksum: 10/8b97cbf9dc6d4c1320cc238a2db0fc67547f9dc77011729ff353faf34f1936ea1a4d7f3c63b2f4980b253be77bcc72ea1e9e76ee3fd53cce2aafb6a8854d07ec - languageName: node - linkType: hard - "pirates@npm:^4.0.4": version: 4.0.5 resolution: "pirates@npm:4.0.5" @@ -7393,18 +7228,6 @@ __metadata: languageName: node linkType: hard -"sha.js@npm:^2.4.9": - version: 2.4.11 - resolution: "sha.js@npm:2.4.11" - dependencies: - inherits: "npm:^2.0.1" - safe-buffer: "npm:^5.0.1" - bin: - sha.js: ./bin.js - checksum: 10/d833bfa3e0a67579a6ce6e1bc95571f05246e0a441dd8c76e3057972f2a3e098465687a4369b07e83a0375a88703577f71b5b2e966809e67ebc340dbedb478c7 - languageName: node - linkType: hard - "shebang-command@npm:^1.2.0": version: 1.2.0 resolution: "shebang-command@npm:1.2.0" @@ -7499,24 +7322,6 @@ __metadata: languageName: node linkType: hard -"simple-concat@npm:^1.0.0": - version: 1.0.1 - resolution: "simple-concat@npm:1.0.1" - checksum: 10/4d211042cc3d73a718c21ac6c4e7d7a0363e184be6a5ad25c8a1502e49df6d0a0253979e3d50dbdd3f60ef6c6c58d756b5d66ac1e05cda9cacd2e9fc59e3876a - languageName: node - linkType: hard - -"simple-get@npm:^4.0.1": - version: 4.0.1 - resolution: "simple-get@npm:4.0.1" - dependencies: - decompress-response: "npm:^6.0.0" - once: "npm:^1.3.1" - simple-concat: "npm:^1.0.0" - checksum: 10/93f1b32319782f78f2f2234e9ce34891b7ab6b990d19d8afefaa44423f5235ce2676aae42d6743fecac6c8dfff4b808d4c24fe5265be813d04769917a9a44f36 - languageName: node - linkType: hard - "simple-git@npm:3.27.0": version: 3.27.0 resolution: "simple-git@npm:3.27.0" @@ -8213,13 +8018,6 @@ __metadata: languageName: node linkType: hard -"universalify@npm:^2.0.0": - version: 2.0.1 - resolution: "universalify@npm:2.0.1" - checksum: 10/ecd8469fe0db28e7de9e5289d32bd1b6ba8f7183db34f3bfc4ca53c49891c2d6aa05f3fb3936a81285a905cc509fb641a0c3fc131ec786167eff41236ae32e60 - languageName: node - linkType: hard - "update-browserslist-db@npm:^1.0.5": version: 1.0.5 resolution: "update-browserslist-db@npm:1.0.5" @@ -8302,13 +8100,6 @@ __metadata: languageName: node linkType: hard -"web-streams-polyfill@npm:^3.0.3": - version: 3.3.3 - resolution: "web-streams-polyfill@npm:3.3.3" - checksum: 10/8e7e13501b3834094a50abe7c0b6456155a55d7571312b89570012ef47ec2a46d766934768c50aabad10a9c30dd764a407623e8bfcc74fcb58495c29130edea9 - languageName: node - linkType: hard - "webidl-conversions@npm:^3.0.0": version: 3.0.1 resolution: "webidl-conversions@npm:3.0.1" From 8338f2cf50c6dc735671e934ff3ac7c86fa1750e Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Fri, 14 Mar 2025 11:35:25 -0500 Subject: [PATCH 11/41] dedup --- yarn.lock | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/yarn.lock b/yarn.lock index a1e6ab2e..ec188708 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2457,7 +2457,7 @@ __metadata: languageName: node linkType: hard -"axios@npm:*, axios@npm:^1.8.3": +"axios@npm:*, axios@npm:^1.7.4, axios@npm:^1.8.3": version: 1.8.3 resolution: "axios@npm:1.8.3" dependencies: @@ -2468,17 +2468,6 @@ __metadata: languageName: node linkType: hard -"axios@npm:^1.7.4": - version: 1.7.9 - resolution: "axios@npm:1.7.9" - dependencies: - follow-redirects: "npm:^1.15.6" - form-data: "npm:^4.0.0" - proxy-from-env: "npm:^1.1.0" - checksum: 10/b7a5f660ea53ba9c2a745bf5ad77ad8bf4f1338e13ccc3f9f09f810267d6c638c03dac88b55dae8dc98b79c57d2d6835be651d58d2af97c174f43d289a9fd007 - languageName: node - linkType: hard - "babel-jest@npm:^28.1.3": version: 28.1.3 resolution: "babel-jest@npm:28.1.3" From f61d45ad54ff0b24f516f459ca5b83b7e9713c59 Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Fri, 14 Mar 2025 12:29:56 -0500 Subject: [PATCH 12/41] add label check --- .github/workflows/changelog-check.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index c7d50da2..d54d36b6 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -9,6 +9,9 @@ on: feature-branch: required: true type: string + pr-number: + required: true + type: string secrets: gh-token: required: true @@ -17,7 +20,6 @@ jobs: check-changelog: runs-on: ubuntu-latest steps: - # Step 1: Checkout github-tools repository - name: Checkout github-tools repository uses: actions/checkout@v4 with: @@ -42,7 +44,20 @@ jobs: shell: bash working-directory: ./github-tools - # Step 4: Run Script + - name: Check PR Labels + id: label-check + run: | + labels=$(curl -H "Authorization: token ${{ secrets.gh-token }}" \ + "https://api.github.com/repos/${{ github.repository }}/issues/${{ inputs.pr-number }}/labels") + if echo "$labels" | jq -e '.[] | select(.name == "no-changelog")'; then + echo "No-changelog label found, skipping changelog check." + exit 0 + else + echo "No-changelog label not found, proceeding with changelog check." + fi + env: + GITHUB_TOKEN: ${{ secrets.gh-token }} + - name: Check Changelog id: changelog-check shell: bash From 4281ed0c33641a0bebcec89958c83d1b9d5e34f5 Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Fri, 14 Mar 2025 13:17:44 -0500 Subject: [PATCH 13/41] pr --- .github/workflows/changelog-check.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index d54d36b6..28992346 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -10,6 +10,9 @@ on: required: true type: string pr-number: + required: false + type: string + event-type: required: true type: string secrets: @@ -20,7 +23,16 @@ jobs: check-changelog: runs-on: ubuntu-latest steps: + - name: Conditional Skip or Execute + run: | + if [[ "${{ inputs.event-type }}" == "merge_group" ]]; then + echo "Merge group event detected, auto-succeeding." + exit 0 + fi + echo "Proceeding with pull request checks." + - name: Checkout github-tools repository + if: ${{ inputs.event-type == 'pull_request' }} uses: actions/checkout@v4 with: repository: MetaMask/github-tools @@ -28,6 +40,7 @@ jobs: path: github-tools - name: Set up Node.js + if: ${{ inputs.event-type == 'pull_request' }} uses: actions/setup-node@v4 with: node-version-file: ./github-tools/.nvmrc @@ -35,22 +48,25 @@ jobs: cache: yarn - name: Enable Corepack + if: ${{ inputs.event-type == 'pull_request' }} run: corepack enable shell: bash working-directory: ./github-tools - name: Install dependencies + if: ${{ inputs.event-type == 'pull_request' }} run: yarn --immutable shell: bash working-directory: ./github-tools - name: Check PR Labels + if: ${{ inputs.event-type == 'pull_request' }} id: label-check run: | labels=$(curl -H "Authorization: token ${{ secrets.gh-token }}" \ "https://api.github.com/repos/${{ github.repository }}/issues/${{ inputs.pr-number }}/labels") if echo "$labels" | jq -e '.[] | select(.name == "no-changelog")'; then - echo "No-changelog label found, skipping changelog check." + echo "no-changelog label found, skipping changelog check." exit 0 else echo "No-changelog label not found, proceeding with changelog check." @@ -59,6 +75,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.gh-token }} - name: Check Changelog + if: ${{ inputs.event-type == 'pull_request' }} id: changelog-check shell: bash env: From 6bb2bb554382c67236cf1b83eb5285a2005682ba Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Fri, 14 Mar 2025 13:30:08 -0500 Subject: [PATCH 14/41] fix label logic --- .github/workflows/changelog-check.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index 28992346..951c6b7a 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -63,19 +63,19 @@ jobs: if: ${{ inputs.event-type == 'pull_request' }} id: label-check run: | - labels=$(curl -H "Authorization: token ${{ secrets.gh-token }}" \ - "https://api.github.com/repos/${{ github.repository }}/issues/${{ inputs.pr-number }}/labels") - if echo "$labels" | jq -e '.[] | select(.name == "no-changelog")'; then + labels=$(curl -H "Authorization: token ${{ secrets.gh-token }}" \ + "https://api.github.com/repos/${{ github.repository }}/issues/${{ inputs.pr-number }}/labels") + if echo "$labels" | jq -e '.[] | select(.name == "no-changelog")'; then + echo "::set-output name=skip-changelog::true" echo "no-changelog label found, skipping changelog check." - exit 0 - else + else + echo "::set-output name=skip-changelog::false" echo "No-changelog label not found, proceeding with changelog check." - fi env: - GITHUB_TOKEN: ${{ secrets.gh-token }} + GITHUB_TOKEN: ${{ secrets.gh-token }} - name: Check Changelog - if: ${{ inputs.event-type == 'pull_request' }} + if: ${{ inputs.event-type == 'pull_request' && steps.label-check.outputs.skip-changelog != 'true' }} id: changelog-check shell: bash env: From c71a795cf6922927cd724077695949ae014ba2c4 Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Fri, 14 Mar 2025 13:32:16 -0500 Subject: [PATCH 15/41] syntax --- .github/workflows/changelog-check.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index 951c6b7a..b6e6479f 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -62,6 +62,7 @@ jobs: - name: Check PR Labels if: ${{ inputs.event-type == 'pull_request' }} id: label-check + shell: bash run: | labels=$(curl -H "Authorization: token ${{ secrets.gh-token }}" \ "https://api.github.com/repos/${{ github.repository }}/issues/${{ inputs.pr-number }}/labels") From b2e4abf22cce9675c6de61883e87740374f77e7f Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Fri, 14 Mar 2025 13:33:32 -0500 Subject: [PATCH 16/41] syntax --- .github/workflows/changelog-check.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index b6e6479f..d0e98eb3 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -62,16 +62,16 @@ jobs: - name: Check PR Labels if: ${{ inputs.event-type == 'pull_request' }} id: label-check - shell: bash run: | labels=$(curl -H "Authorization: token ${{ secrets.gh-token }}" \ "https://api.github.com/repos/${{ github.repository }}/issues/${{ inputs.pr-number }}/labels") if echo "$labels" | jq -e '.[] | select(.name == "no-changelog")'; then - echo "::set-output name=skip-changelog::true" - echo "no-changelog label found, skipping changelog check." + echo "::set-output name=skip-changelog::true" + echo "no-changelog label found, skipping changelog check." else - echo "::set-output name=skip-changelog::false" - echo "No-changelog label not found, proceeding with changelog check." + echo "::set-output name=skip-changelog::false" + echo "No-changelog label not found, proceeding with changelog check." + fi env: GITHUB_TOKEN: ${{ secrets.gh-token }} From b32e2b93700ebf72f1a8a61aa0440b72c1a7d4f8 Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Fri, 14 Mar 2025 13:43:49 -0500 Subject: [PATCH 17/41] fix --- .github/workflows/changelog-check.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index d0e98eb3..7770c612 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -63,20 +63,20 @@ jobs: if: ${{ inputs.event-type == 'pull_request' }} id: label-check run: | - labels=$(curl -H "Authorization: token ${{ secrets.gh-token }}" \ - "https://api.github.com/repos/${{ github.repository }}/issues/${{ inputs.pr-number }}/labels") - if echo "$labels" | jq -e '.[] | select(.name == "no-changelog")'; then - echo "::set-output name=skip-changelog::true" - echo "no-changelog label found, skipping changelog check." - else - echo "::set-output name=skip-changelog::false" - echo "No-changelog label not found, proceeding with changelog check." - fi + labels=$(curl -H "Authorization: token ${{ secrets.gh-token }}" \ + "https://api.github.com/repos/${{ github.repository }}/issues/${{ inputs.pr-number }}/labels") + if echo "$labels" | jq -e '.[] | select(.name == "no-changelog")'; then + echo "no-changelog label found, skipping changelog check." + echo "SKIP_CHANGELOG=true" >> $GITHUB_ENV + else + echo "SKIP_CHANGELOG=false" >> $GITHUB_ENV + echo "No-changelog label not found, proceeding with changelog check." env: - GITHUB_TOKEN: ${{ secrets.gh-token }} + GITHUB_TOKEN: ${{ secrets.gh-token }} + - name: Check Changelog - if: ${{ inputs.event-type == 'pull_request' && steps.label-check.outputs.skip-changelog != 'true' }} + if: ${{ inputs.event-type == 'pull_request' && env.SKIP_CHANGELOG != 'true' }} id: changelog-check shell: bash env: From 778c758dda29c6acd4eb3d4f26031c9555a518de Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Fri, 14 Mar 2025 13:47:39 -0500 Subject: [PATCH 18/41] syntax --- .github/workflows/changelog-check.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index 7770c612..88b236ce 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -71,8 +71,10 @@ jobs: else echo "SKIP_CHANGELOG=false" >> $GITHUB_ENV echo "No-changelog label not found, proceeding with changelog check." + fi env: GITHUB_TOKEN: ${{ secrets.gh-token }} + shell: bash - name: Check Changelog From 1df1e5dfbcde171ada585b9b92ad46a012ce6c77 Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Fri, 14 Mar 2025 13:50:25 -0500 Subject: [PATCH 19/41] changelog --- .github/workflows/changelog-check.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index 88b236ce..75701450 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -74,8 +74,7 @@ jobs: fi env: GITHUB_TOKEN: ${{ secrets.gh-token }} - shell: bash - + shell: bash - name: Check Changelog if: ${{ inputs.event-type == 'pull_request' && env.SKIP_CHANGELOG != 'true' }} From 2f2ee4821c5cf54232106060bae2ae04bb8e2325 Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Fri, 14 Mar 2025 13:53:09 -0500 Subject: [PATCH 20/41] globbing lint --- .github/workflows/changelog-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index 75701450..375f16f1 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -63,7 +63,7 @@ jobs: if: ${{ inputs.event-type == 'pull_request' }} id: label-check run: | - labels=$(curl -H "Authorization: token ${{ secrets.gh-token }}" \ + labels=$(curl -H "Authorization: token '${{ secrets.gh-token }}'" \ "https://api.github.com/repos/${{ github.repository }}/issues/${{ inputs.pr-number }}/labels") if echo "$labels" | jq -e '.[] | select(.name == "no-changelog")'; then echo "no-changelog label found, skipping changelog check." From 1d2a6580bb31422a4ce80258b80bb296ac2b7d9a Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Fri, 14 Mar 2025 14:14:05 -0500 Subject: [PATCH 21/41] diff --- .github/workflows/changelog-check.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index 375f16f1..997a49b0 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -63,6 +63,7 @@ jobs: if: ${{ inputs.event-type == 'pull_request' }} id: label-check run: | + # shellcheck disable=SC2086 labels=$(curl -H "Authorization: token '${{ secrets.gh-token }}'" \ "https://api.github.com/repos/${{ github.repository }}/issues/${{ inputs.pr-number }}/labels") if echo "$labels" | jq -e '.[] | select(.name == "no-changelog")'; then From 947179d026dec3a62c4f4cab4128d017cc14ed44 Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Fri, 14 Mar 2025 14:16:02 -0500 Subject: [PATCH 22/41] shellcheck --- .github/workflows/changelog-check.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index 997a49b0..08e66d5e 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -59,6 +59,7 @@ jobs: shell: bash working-directory: ./github-tools + # shellcheck disable=SC2086 - name: Check PR Labels if: ${{ inputs.event-type == 'pull_request' }} id: label-check From d49b71c52a41ae5857a1745637dca80a4a4377b8 Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Fri, 14 Mar 2025 14:23:32 -0500 Subject: [PATCH 23/41] shellcheck --- .github/workflows/changelog-check.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index 08e66d5e..997a49b0 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -59,7 +59,6 @@ jobs: shell: bash working-directory: ./github-tools - # shellcheck disable=SC2086 - name: Check PR Labels if: ${{ inputs.event-type == 'pull_request' }} id: label-check From 39d63798bf1f8ff077e3759e0a5edbdebdf306d6 Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Fri, 14 Mar 2025 14:25:08 -0500 Subject: [PATCH 24/41] shellcheck --- .github/workflows/changelog-check.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index 997a49b0..1a2fb117 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -63,9 +63,15 @@ jobs: if: ${{ inputs.event-type == 'pull_request' }} id: label-check run: | - # shellcheck disable=SC2086 - labels=$(curl -H "Authorization: token '${{ secrets.gh-token }}'" \ - "https://api.github.com/repos/${{ github.repository }}/issues/${{ inputs.pr-number }}/labels") + # Use double quotes and properly handle dynamic data within the bash context + repo="${{ github.repository }}" + pr_number="${{ inputs.pr-number }}" + gh_token="${{ secrets.gh-token }}" + + # Use the variables in a way that ShellCheck will not flag + labels=$(curl -H "Authorization: token '${gh_token}'" \ + "https://api.github.com/repos/${repo}/issues/${pr_number}/labels") + if echo "$labels" | jq -e '.[] | select(.name == "no-changelog")'; then echo "no-changelog label found, skipping changelog check." echo "SKIP_CHANGELOG=true" >> $GITHUB_ENV From 7bdaf820a857fb8fa5b61324f8cd66850d60ae91 Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Fri, 14 Mar 2025 14:26:38 -0500 Subject: [PATCH 25/41] test --- .github/workflows/changelog-check.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index 1a2fb117..7c57aa21 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -64,9 +64,9 @@ jobs: id: label-check run: | # Use double quotes and properly handle dynamic data within the bash context - repo="${{ github.repository }}" - pr_number="${{ inputs.pr-number }}" - gh_token="${{ secrets.gh-token }}" + repo=${{ github.repository }} + pr_number=${{ inputs.pr-number }} + gh_token=${{ secrets.gh-token }} # Use the variables in a way that ShellCheck will not flag labels=$(curl -H "Authorization: token '${gh_token}'" \ From 1fcd7444a0527cf3838668bfa60c00d560b9dfaa Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Fri, 14 Mar 2025 14:29:54 -0500 Subject: [PATCH 26/41] lint --- .github/workflows/changelog-check.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index 7c57aa21..0af650c1 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -69,8 +69,7 @@ jobs: gh_token=${{ secrets.gh-token }} # Use the variables in a way that ShellCheck will not flag - labels=$(curl -H "Authorization: token '${gh_token}'" \ - "https://api.github.com/repos/${repo}/issues/${pr_number}/labels") + labels=$(curl -H "Authorization: token ${gh_token} https://api.github.com/repos/${repo}/issues/${pr_number}/labels) if echo "$labels" | jq -e '.[] | select(.name == "no-changelog")'; then echo "no-changelog label found, skipping changelog check." From 70ca87615a53be72b18dc3ea009b1edcc3d9013b Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Fri, 14 Mar 2025 14:33:44 -0500 Subject: [PATCH 27/41] testing --- .github/workflows/changelog-check.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index 0af650c1..75395966 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -63,14 +63,10 @@ jobs: if: ${{ inputs.event-type == 'pull_request' }} id: label-check run: | - # Use double quotes and properly handle dynamic data within the bash context - repo=${{ github.repository }} - pr_number=${{ inputs.pr-number }} - gh_token=${{ secrets.gh-token }} - - # Use the variables in a way that ShellCheck will not flag - labels=$(curl -H "Authorization: token ${gh_token} https://api.github.com/repos/${repo}/issues/${pr_number}/labels) - + #!/bin/sh + # shellcheck disable=SC2086 + labels=$(curl -H "Authorization: token '${{ secrets.gh-token }}'" \ + "https://api.github.com/repos/${{ github.repository }}/issues/${{ inputs.pr-number }}/labels") if echo "$labels" | jq -e '.[] | select(.name == "no-changelog")'; then echo "no-changelog label found, skipping changelog check." echo "SKIP_CHANGELOG=true" >> $GITHUB_ENV @@ -80,7 +76,6 @@ jobs: fi env: GITHUB_TOKEN: ${{ secrets.gh-token }} - shell: bash - name: Check Changelog if: ${{ inputs.event-type == 'pull_request' && env.SKIP_CHANGELOG != 'true' }} From 9e9ca3f2e315d8222ee358cb3d7f26e5ea137c41 Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Fri, 14 Mar 2025 14:36:51 -0500 Subject: [PATCH 28/41] lint --- .github/actionlint.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/actionlint.yml b/.github/actionlint.yml index e83312f9..db3495ac 100644 --- a/.github/actionlint.yml +++ b/.github/actionlint.yml @@ -3,3 +3,7 @@ paths: ignore: # We need to ignore the expected missing inputs in test-checkout-and-setup.yml - 'missing input "is-high-risk-environment".+' + .github/workflows/changelog-check.yml: + ignore: + # Ignore SC2086 warnings related to shell commands + - 'SC2086:.+' From b8d06f34658815a42b6f2e964ff5e2ccfca648fe Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Fri, 14 Mar 2025 14:41:06 -0500 Subject: [PATCH 29/41] fmt --- .github/workflows/changelog-check.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index 75395966..b27197fa 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -63,8 +63,6 @@ jobs: if: ${{ inputs.event-type == 'pull_request' }} id: label-check run: | - #!/bin/sh - # shellcheck disable=SC2086 labels=$(curl -H "Authorization: token '${{ secrets.gh-token }}'" \ "https://api.github.com/repos/${{ github.repository }}/issues/${{ inputs.pr-number }}/labels") if echo "$labels" | jq -e '.[] | select(.name == "no-changelog")'; then @@ -72,10 +70,11 @@ jobs: echo "SKIP_CHANGELOG=true" >> $GITHUB_ENV else echo "SKIP_CHANGELOG=false" >> $GITHUB_ENV - echo "No-changelog label not found, proceeding with changelog check." + echo "no-changelog label not found, proceeding with changelog check." fi env: GITHUB_TOKEN: ${{ secrets.gh-token }} + shell: bash - name: Check Changelog if: ${{ inputs.event-type == 'pull_request' && env.SKIP_CHANGELOG != 'true' }} From fe80e61d442c341e6720a8be009a07795c0d61a8 Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Fri, 14 Mar 2025 14:50:08 -0500 Subject: [PATCH 30/41] fmt --- .github/workflows/changelog-check.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index b27197fa..bdacdd06 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -63,18 +63,26 @@ jobs: if: ${{ inputs.event-type == 'pull_request' }} id: label-check run: | - labels=$(curl -H "Authorization: token '${{ secrets.gh-token }}'" \ + # Fetch labels from the GitHub API + labels=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ "https://api.github.com/repos/${{ github.repository }}/issues/${{ inputs.pr-number }}/labels") + + # Print the raw response for debugging + echo "API Response Body:" + echo "$labels" + + # Proceed with checking for the 'no-changelog' label using jq if echo "$labels" | jq -e '.[] | select(.name == "no-changelog")'; then - echo "no-changelog label found, skipping changelog check." + echo "No-changelog label found, skipping changelog check." echo "SKIP_CHANGELOG=true" >> $GITHUB_ENV else echo "SKIP_CHANGELOG=false" >> $GITHUB_ENV - echo "no-changelog label not found, proceeding with changelog check." + echo "No-changelog label not found, proceeding with changelog check." fi env: GITHUB_TOKEN: ${{ secrets.gh-token }} shell: bash + - name: Check Changelog if: ${{ inputs.event-type == 'pull_request' && env.SKIP_CHANGELOG != 'true' }} From c25f4157558a7a92f395db52af188679b038549d Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Fri, 14 Mar 2025 14:52:51 -0500 Subject: [PATCH 31/41] fmt --- .github/workflows/changelog-check.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index bdacdd06..a7f51ba5 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -67,10 +67,6 @@ jobs: labels=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ "https://api.github.com/repos/${{ github.repository }}/issues/${{ inputs.pr-number }}/labels") - # Print the raw response for debugging - echo "API Response Body:" - echo "$labels" - # Proceed with checking for the 'no-changelog' label using jq if echo "$labels" | jq -e '.[] | select(.name == "no-changelog")'; then echo "No-changelog label found, skipping changelog check." From 265ca444cd817aa233f6ff95d0cd63e84ffa968e Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Fri, 14 Mar 2025 15:07:45 -0500 Subject: [PATCH 32/41] lint --- .github/workflows/changelog-check.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index a7f51ba5..cc929589 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -66,7 +66,7 @@ jobs: # Fetch labels from the GitHub API labels=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ "https://api.github.com/repos/${{ github.repository }}/issues/${{ inputs.pr-number }}/labels") - + # Proceed with checking for the 'no-changelog' label using jq if echo "$labels" | jq -e '.[] | select(.name == "no-changelog")'; then echo "No-changelog label found, skipping changelog check." @@ -78,7 +78,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.gh-token }} shell: bash - - name: Check Changelog if: ${{ inputs.event-type == 'pull_request' && env.SKIP_CHANGELOG != 'true' }} From 3b791980d8fdf3e41d2622c11ec2a210604c82a2 Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Mon, 24 Mar 2025 15:05:25 -0500 Subject: [PATCH 33/41] chore: remove comments --- src/changelog-check.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/changelog-check.ts b/src/changelog-check.ts index e616d3eb..7726646a 100644 --- a/src/changelog-check.ts +++ b/src/changelog-check.ts @@ -1,5 +1,5 @@ import axios from 'axios'; -import { diffLines } from 'diff'; // Import diff library +import { diffLines } from 'diff'; // Manually define types for changelog-parser since it lacks official TypeScript support type Release = { @@ -36,7 +36,6 @@ async function fetchChangelogFromGitHub( repo: string, branch: string, ): Promise { - // Use raw.githubusercontent.com to directly fetch file content const url = `https://raw.githubusercontent.com/${repo}/${branch}/CHANGELOG.md`; // eslint-disable-next-line n/no-process-env const token = process.env.GITHUB_TOKEN ?? ''; @@ -44,10 +43,10 @@ async function fetchChangelogFromGitHub( try { const response = await axios.get(url, { headers: token ? { Authorization: `Bearer ${token}` } : {}, - responseType: 'text', // Ensure we get raw text + responseType: 'text', }); - return response.data; // Directly return the raw content + return response.data; } catch (error) { console.error( `❌ Error fetching CHANGELOG.md from ${branch} on ${repo}:`, From 4c8b7d48b5ec91c2bf3a2c0c71d1364b6495bad3 Mon Sep 17 00:00:00 2001 From: jake-perkins <128608287+jake-perkins@users.noreply.github.com> Date: Mon, 24 Mar 2025 15:39:00 -0500 Subject: [PATCH 34/41] Update src/changelog-check.ts Co-authored-by: Norbert Elter <72046715+itsyoboieltr@users.noreply.github.com> --- src/changelog-check.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/changelog-check.ts b/src/changelog-check.ts index 7726646a..ac01cae5 100644 --- a/src/changelog-check.ts +++ b/src/changelog-check.ts @@ -177,7 +177,7 @@ async function validateChangelog( const args = process.argv.slice(2); if (args.length < 3) { console.error( - '❌ Usage: node scripts/check-changelog.js ', + '❌ Usage: ts-node src/check-changelog.ts ', ); throw new Error('❌ Missing required arguments.'); } From 0020d1a24eda9be7f559b52a83a287688783fff8 Mon Sep 17 00:00:00 2001 From: jake-perkins <128608287+jake-perkins@users.noreply.github.com> Date: Mon, 24 Mar 2025 15:39:09 -0500 Subject: [PATCH 35/41] Update src/changelog-check.ts Co-authored-by: Norbert Elter <72046715+itsyoboieltr@users.noreply.github.com> --- src/changelog-check.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/changelog-check.ts b/src/changelog-check.ts index ac01cae5..9af345bc 100644 --- a/src/changelog-check.ts +++ b/src/changelog-check.ts @@ -187,7 +187,7 @@ const [githubRepo, baseBranch, featureBranch] = args; // Ensure all required arguments are provided if (!githubRepo || !baseBranch || !featureBranch) { console.error( - '✅ Usage: ts-node scripts/check-changelog.ts ', + '❌ Usage: ts-node src/check-changelog.ts ', ); throw new Error('❌ Missing required arguments.'); } From 03836c539a20ff4b6f9bf7ad2dd36d4e808494b7 Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Mon, 7 Apr 2025 20:20:55 -0500 Subject: [PATCH 36/41] code-review-updates --- .github/workflows/changelog-check.yml | 18 +- package.json | 14 +- src/changelog-check.ts | 132 ++++-------- yarn.lock | 290 ++++++++++++++++---------- 4 files changed, 232 insertions(+), 222 deletions(-) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index cc929589..63307834 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -12,9 +12,6 @@ on: pr-number: required: false type: string - event-type: - required: true - type: string secrets: gh-token: required: true @@ -23,16 +20,7 @@ jobs: check-changelog: runs-on: ubuntu-latest steps: - - name: Conditional Skip or Execute - run: | - if [[ "${{ inputs.event-type }}" == "merge_group" ]]; then - echo "Merge group event detected, auto-succeeding." - exit 0 - fi - echo "Proceeding with pull request checks." - - name: Checkout github-tools repository - if: ${{ inputs.event-type == 'pull_request' }} uses: actions/checkout@v4 with: repository: MetaMask/github-tools @@ -40,7 +28,6 @@ jobs: path: github-tools - name: Set up Node.js - if: ${{ inputs.event-type == 'pull_request' }} uses: actions/setup-node@v4 with: node-version-file: ./github-tools/.nvmrc @@ -48,19 +35,16 @@ jobs: cache: yarn - name: Enable Corepack - if: ${{ inputs.event-type == 'pull_request' }} run: corepack enable shell: bash working-directory: ./github-tools - name: Install dependencies - if: ${{ inputs.event-type == 'pull_request' }} run: yarn --immutable shell: bash working-directory: ./github-tools - name: Check PR Labels - if: ${{ inputs.event-type == 'pull_request' }} id: label-check run: | # Fetch labels from the GitHub API @@ -80,7 +64,7 @@ jobs: shell: bash - name: Check Changelog - if: ${{ inputs.event-type == 'pull_request' && env.SKIP_CHANGELOG != 'true' }} + if: env.SKIP_CHANGELOG != 'true' id: changelog-check shell: bash env: diff --git a/package.json b/package.json index c3d3bb74..85970a4b 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "update-release-sheet": "node .github/scripts/update-release-sheet.mjs" }, "dependencies": { + "@metamask/auto-changelog": "4.1.0", "@metamask/utils": "^7.1.0", "@octokit/graphql": "^7.0.1", "@octokit/request": "^8.1.1", @@ -28,9 +29,7 @@ "@slack/web-api": "^6.0.0", "@types/luxon": "^3.3.0", "axios": "^1.8.3", - "changelog-parser": "3.0.1", "csv-parse": "5.6.0", - "diff": "^7.0.0", "googleapis": "144.0.0", "luxon": "^3.3.0", "ora": "^5.4.1", @@ -55,17 +54,17 @@ "@typescript-eslint/parser": "^5.43.0", "depcheck": "^1.4.3", "eslint": "^8.44.0", - "eslint-config-prettier": "^8.8.0", + "eslint-config-prettier": "^9.1.0", "eslint-plugin-import": "^2.27.5", "eslint-plugin-jest": "^27.2.2", "eslint-plugin-jsdoc": "^39.9.1", "eslint-plugin-n": "^15.7.0", - "eslint-plugin-prettier": "^4.2.1", + "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-promise": "^6.1.1", "jest": "^28.1.3", "jest-it-up": "^2.0.2", - "prettier": "^2.7.1", - "prettier-plugin-packagejson": "^2.3.0", + "prettier": "^3.3.3", + "prettier-plugin-packagejson": "^2.5.2", "ts-jest": "^28.0.7", "ts-node": "^10.9.1", "typescript": "^5.1.3" @@ -74,6 +73,9 @@ "engines": { "node": ">=20.0.0" }, + "peerDependencies": { + "prettier": ">=3.0.0" + }, "lavamoat": { "allowScripts": { "@lavamoat/preinstall-always-fail": false, diff --git a/src/changelog-check.ts b/src/changelog-check.ts index 9af345bc..c03b7236 100644 --- a/src/changelog-check.ts +++ b/src/changelog-check.ts @@ -1,5 +1,5 @@ -import axios from 'axios'; -import { diffLines } from 'diff'; +import fetch from 'node-fetch'; +import { parseChangelog } from '@metamask/auto-changelog'; // Manually define types for changelog-parser since it lacks official TypeScript support type Release = { @@ -10,17 +10,6 @@ type Release = { parsed: Record; }; -type Changelog = { - title: string; - description: string; - versions: Release[]; -}; - -const changelogParser: (options: { - filePath?: string; - text?: string; - // eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires -}) => Promise = require('changelog-parser'); /** * Asynchronously fetches the CHANGELOG.md file content from a specified GitHub repository and branch. @@ -41,87 +30,48 @@ async function fetchChangelogFromGitHub( const token = process.env.GITHUB_TOKEN ?? ''; try { - const response = await axios.get(url, { - headers: token ? { Authorization: `Bearer ${token}` } : {}, - responseType: 'text', + const headers = token ? { 'Authorization': `Bearer ${token}` } : {}; + const response = await fetch(url, { + headers: headers }); - return response.data; + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + + return await response.text(); } catch (error) { console.error( `❌ Error fetching CHANGELOG.md from ${branch} on ${repo}:`, - error, + error ); - return ''; + throw error; } } -/** - * Parses the content of a CHANGELOG.md file to extract the section marked as "[Unreleased]". - * @param content - The raw markdown content of the CHANGELOG.md file to be parsed. - * @returns A promise that resolves to the markdown content of the "[Unreleased]" section, - * or an empty string if the section is not found or an error occurs. - */ -async function parseChangelog(content: string): Promise { - try { - const parsed: Changelog = await changelogParser({ text: content }); - - // Try to find the "[Unreleased]" section - const unreleasedSection = parsed.versions.find( - (ver) => ver.title.trim().toLowerCase() === '[unreleased]', - ); - - if (!unreleasedSection) { - console.warn( - "⚠️ '[Unreleased]' section not found! Check the formatting in CHANGELOG.md.", - ); - return ''; - } - - return unreleasedSection.body; - } catch (error) { - console.error('❌ Error parsing CHANGELOG.md:', error); - return ''; - } -} /** - * Displays the differences between two sets of changelog entries. + * Determines if there's a difference in the changelog entries between the base and feature branches. * @param baseChanges - The content of the '[Unreleased]' section from the base branch's CHANGELOG.md. * @param featureChanges - The content of the '[Unreleased]' section from the feature branch's CHANGELOG.md. */ -function displayDiff(baseChanges: string, featureChanges: string) { - // Compute the line-by-line differences - const differences = diffLines(baseChanges, featureChanges); - - const addedLines: string[] = []; - const removedLines: string[] = []; - - // Collect added and removed lines into separate lists - differences.forEach((part) => { - if (part.added) { - addedLines.push(part.value.trim()); // Trim to remove leading/trailing spaces - } else if (part.removed) { - removedLines.push(part.value.trim()); - } - }); +function compareChangeLogs(baseChanges: string[], featureChanges: string[]): boolean { + const newEntries = featureChanges.filter(entry => !baseChanges.includes(entry)); - // Print the diff summary - console.log("🔍 Diff between base and feature '[Unreleased]' sections:"); - - if (removedLines.length > 0) { - console.log('❌ Removed:'); - removedLines.forEach((line) => console.log(`${line}`)); - } else { - console.log('❌ No removed lines.'); + // Log and return true if there are new entries + if (newEntries.length > 0) { + console.log('New entries in feature branch:', newEntries); + return true; } - if (addedLines.length > 0) { - console.log('✅ Added:'); - addedLines.forEach((line) => console.log(`${line}`)); - } else { - console.log('✅ No added lines.'); + // Check if the number of entries has changed + if (baseChanges.length !== featureChanges.length) { + console.log('The number of entries has changed. Base branch has', baseChanges.length, 'entries, while feature branch has', featureChanges.length, 'entries.'); + return true; } + + // If no new entries and the size has not changed, return false + return false; } /** @@ -150,21 +100,29 @@ async function validateChangelog( throw new Error('❌ CHANGELOG.md is missing in the feature branch.'); } - // Parse the changelogs - const baseChanges = await parseChangelog(baseChangelogContent); - const featureChanges = await parseChangelog(featureChangelogContent); + const baseUnreleasedChanges = parseChangelog({ + changelogContent: baseChangelogContent, + repoUrl: '', // Not needed as we're only parsing unreleased changes + }).getReleaseChanges('Unreleased'); + + const featureUnreleasedChanges = parseChangelog({ + changelogContent: featureChangelogContent, + repoUrl: '', // Not needed as we're only parsing unreleased changes + }).getReleaseChanges('Unreleased'); + + + const baseChanges = Object.values(baseUnreleasedChanges).flat(); + const featureChanges = Object.values(featureUnreleasedChanges).flat(); console.log('🔍 Comparing changelog entries...'); - console.log('Base unreleased section:', baseChanges); - console.log('Feature unreleased section:', featureChanges); + console.log('Base unreleased section:', baseUnreleasedChanges); + console.log('Feature unreleased section:', featureUnreleasedChanges); - displayDiff(baseChanges, featureChanges); - if (baseChanges === featureChanges) { - console.log( - "❌ No new entries detected under '## Unreleased'. Please update the changelog.", - ); + const hasChanges = compareChangeLogs(baseChanges, featureChanges); + + if(!hasChanges) { throw new Error( "❌ No new entries detected under '## Unreleased'. Please update the changelog.", ); @@ -177,7 +135,7 @@ async function validateChangelog( const args = process.argv.slice(2); if (args.length < 3) { console.error( - '❌ Usage: ts-node src/check-changelog.ts ', + '❌ Usage: ts-node scripts/check-changelog.js ', ); throw new Error('❌ Missing required arguments.'); } diff --git a/yarn.lock b/yarn.lock index ec188708..f3bfb929 100644 --- a/yarn.lock +++ b/yarn.lock @@ -941,6 +941,22 @@ __metadata: languageName: node linkType: hard +"@metamask/auto-changelog@npm:4.1.0": + version: 4.1.0 + resolution: "@metamask/auto-changelog@npm:4.1.0" + dependencies: + diff: "npm:^5.0.0" + execa: "npm:^5.1.1" + semver: "npm:^7.3.5" + yargs: "npm:^17.0.1" + peerDependencies: + prettier: ">=3.0.0" + bin: + auto-changelog: dist/cli.js + checksum: 10/fe31a9eb364939c83bc5098482b761ca93593081680c4cba17b221150b4d32636cb25fd708e3692c198feddc95d8bcf524e19fa93567fb5aa30b03ea93249250 + languageName: node + linkType: hard + "@metamask/eslint-config-jest@npm:^12.0.0": version: 12.1.0 resolution: "@metamask/eslint-config-jest@npm:12.1.0" @@ -997,6 +1013,7 @@ __metadata: dependencies: "@lavamoat/allow-scripts": "npm:^2.3.1" "@lavamoat/preinstall-always-fail": "npm:^1.0.0" + "@metamask/auto-changelog": "npm:4.1.0" "@metamask/eslint-config": "npm:^12.0.0" "@metamask/eslint-config-jest": "npm:^12.0.0" "@metamask/eslint-config-nodejs": "npm:^12.0.0" @@ -1018,29 +1035,29 @@ __metadata: "@typescript-eslint/eslint-plugin": "npm:^5.43.0" "@typescript-eslint/parser": "npm:^5.43.0" axios: "npm:^1.8.3" - changelog-parser: "npm:3.0.1" csv-parse: "npm:5.6.0" depcheck: "npm:^1.4.3" - diff: "npm:^7.0.0" eslint: "npm:^8.44.0" - eslint-config-prettier: "npm:^8.8.0" + eslint-config-prettier: "npm:^9.1.0" eslint-plugin-import: "npm:^2.27.5" eslint-plugin-jest: "npm:^27.2.2" eslint-plugin-jsdoc: "npm:^39.9.1" eslint-plugin-n: "npm:^15.7.0" - eslint-plugin-prettier: "npm:^4.2.1" + eslint-plugin-prettier: "npm:^5.2.1" eslint-plugin-promise: "npm:^6.1.1" googleapis: "npm:144.0.0" jest: "npm:^28.1.3" jest-it-up: "npm:^2.0.2" luxon: "npm:^3.3.0" ora: "npm:^5.4.1" - prettier: "npm:^2.7.1" - prettier-plugin-packagejson: "npm:^2.3.0" + prettier: "npm:^3.3.3" + prettier-plugin-packagejson: "npm:^2.5.2" simple-git: "npm:3.27.0" ts-jest: "npm:^28.0.7" ts-node: "npm:^10.9.1" typescript: "npm:^5.1.3" + peerDependencies: + prettier: ">=3.0.0" languageName: unknown linkType: soft @@ -1373,6 +1390,20 @@ __metadata: languageName: node linkType: hard +"@pkgr/core@npm:^0.1.0": + version: 0.1.2 + resolution: "@pkgr/core@npm:0.1.2" + checksum: 10/5160ec9f2e3232da681824a42583ef80e637ae6143339bd1db176848efd244dd71d177ccb7fd729261d8dcaf88486ce701d39500d873ed5caf16e8c281e9e28a + languageName: node + linkType: hard + +"@pkgr/core@npm:^0.2.1": + version: 0.2.1 + resolution: "@pkgr/core@npm:0.2.1" + checksum: 10/f644417c46b31fef0eb67353562d844e38ddb381c8b8b00053c0410e43cbc4999a038c742599b0cf957ed753978a058ebd60694e38a9e5bc8242639fd57cfe2a + languageName: node + linkType: hard + "@scure/base@npm:~1.1.0": version: 1.1.2 resolution: "@scure/base@npm:1.1.2" @@ -1760,16 +1791,6 @@ __metadata: languageName: node linkType: hard -"@types/glob@npm:^7.1.1": - version: 7.1.3 - resolution: "@types/glob@npm:7.1.3" - dependencies: - "@types/minimatch": "npm:*" - "@types/node": "npm:*" - checksum: 10/e0eef12285f548f15d887145590594a04ccce7f7e645fb047cbac18cb093f25d507ffbcc725312294c224bb78cf980fce33e5807de8d6f8a868b4186253499d4 - languageName: node - linkType: hard - "@types/graceful-fs@npm:^4.1.3": version: 4.1.5 resolution: "@types/graceful-fs@npm:4.1.5" @@ -1869,7 +1890,7 @@ __metadata: languageName: node linkType: hard -"@types/minimatch@npm:*, @types/minimatch@npm:^3.0.3": +"@types/minimatch@npm:^3.0.3": version: 3.0.5 resolution: "@types/minimatch@npm:3.0.5" checksum: 10/c41d136f67231c3131cf1d4ca0b06687f4a322918a3a5adddc87ce90ed9dbd175a3610adee36b106ae68c0b92c637c35e02b58c8a56c424f71d30993ea220b92 @@ -2855,18 +2876,6 @@ __metadata: languageName: node linkType: hard -"changelog-parser@npm:3.0.1": - version: 3.0.1 - resolution: "changelog-parser@npm:3.0.1" - dependencies: - line-reader: "npm:^0.2.4" - remove-markdown: "npm:^0.5.0" - bin: - changelog-parser: bin/cli.js - checksum: 10/681c10f43aaa02eb4706a4b883d464fee499dc1dfee679fb9414155b1c3a935126b97d2d0092f07ff62cbe431cf5926a4636856446ff40338ecc20b235ed2692 - languageName: node - linkType: hard - "char-regex@npm:^1.0.2": version: 1.0.2 resolution: "char-regex@npm:1.0.2" @@ -3320,20 +3329,27 @@ __metadata: languageName: node linkType: hard -"detect-indent@npm:^6.0.0": - version: 6.1.0 - resolution: "detect-indent@npm:6.1.0" - checksum: 10/ab953a73c72dbd4e8fc68e4ed4bfd92c97eb6c43734af3900add963fd3a9316f3bc0578b018b24198d4c31a358571eff5f0656e81a1f3b9ad5c547d58b2d093d +"detect-indent@npm:^7.0.1": + version: 7.0.1 + resolution: "detect-indent@npm:7.0.1" + checksum: 10/cbf3f0b1c3c881934ca94428e1179b26ab2a587e0d719031d37a67fb506d49d067de54ff057cb1e772e75975fed5155c01cd4518306fee60988b1486e3fc7768 languageName: node linkType: hard -"detect-newline@npm:3.1.0, detect-newline@npm:^3.0.0": +"detect-newline@npm:^3.0.0": version: 3.1.0 resolution: "detect-newline@npm:3.1.0" checksum: 10/ae6cd429c41ad01b164c59ea36f264a2c479598e61cba7c99da24175a7ab80ddf066420f2bec9a1c57a6bead411b4655ff15ad7d281c000a89791f48cbe939e7 languageName: node linkType: hard +"detect-newline@npm:^4.0.0": + version: 4.0.1 + resolution: "detect-newline@npm:4.0.1" + checksum: 10/0409ecdfb93419591ccff24fccfe2ddddad29b66637d1ed898872125b25af05014fdeedc9306339577060f69f59fe6e9830cdd80948597f136dfbffefa60599c + languageName: node + linkType: hard + "diff-sequences@npm:^28.1.1": version: 28.1.1 resolution: "diff-sequences@npm:28.1.1" @@ -3348,10 +3364,10 @@ __metadata: languageName: node linkType: hard -"diff@npm:^7.0.0": - version: 7.0.0 - resolution: "diff@npm:7.0.0" - checksum: 10/e9b8e48d054c9c0c093c65ce8e2637af94b35f2427001607b14e5e0589e534ea3413a7f91ebe6d7c5a1494ace49cb7c7c3972f442ddd96a4767ff091999a082e +"diff@npm:^5.0.0": + version: 5.2.0 + resolution: "diff@npm:5.2.0" + checksum: 10/01b7b440f83a997350a988e9d2f558366c0f90f15be19f4aa7f1bb3109a4e153dfc3b9fbf78e14ea725717017407eeaa2271e3896374a0181e8f52445740846d languageName: node linkType: hard @@ -3600,14 +3616,14 @@ __metadata: languageName: node linkType: hard -"eslint-config-prettier@npm:^8.8.0": - version: 8.10.0 - resolution: "eslint-config-prettier@npm:8.10.0" +"eslint-config-prettier@npm:^9.1.0": + version: 9.1.0 + resolution: "eslint-config-prettier@npm:9.1.0" peerDependencies: eslint: ">=7.0.0" bin: eslint-config-prettier: bin/cli.js - checksum: 10/0a51ab1417cbf80fabcf7a406960a142663539c8140fdb0a187b78f3d708b9d137a62a4bc4e689150e290b667750ddabd1740a516623b0cb4adb6cc1962cfe2c + checksum: 10/411e3b3b1c7aa04e3e0f20d561271b3b909014956c4dba51c878bf1a23dbb8c800a3be235c46c4732c70827276e540b6eed4636d9b09b444fd0a8e07f0fcd830 languageName: node linkType: hard @@ -3726,18 +3742,23 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-prettier@npm:^4.2.1": - version: 4.2.1 - resolution: "eslint-plugin-prettier@npm:4.2.1" +"eslint-plugin-prettier@npm:^5.2.1": + version: 5.2.6 + resolution: "eslint-plugin-prettier@npm:5.2.6" dependencies: prettier-linter-helpers: "npm:^1.0.0" + synckit: "npm:^0.11.0" peerDependencies: - eslint: ">=7.28.0" - prettier: ">=2.0.0" + "@types/eslint": ">=8.0.0" + eslint: ">=8.0.0" + eslint-config-prettier: ">= 7.0.0 <10.0.0 || >=10.1.0" + prettier: ">=3.0.0" peerDependenciesMeta: + "@types/eslint": + optional: true eslint-config-prettier: optional: true - checksum: 10/d387f85dd1bfcb6bc6b794845fee6afb9ebb2375653de6bcde6e615892fb97f85121a7c012a4651b181fc09953bdf54c9bc70cab7ad297019d89ae87dd007e28 + checksum: 10/8f82a3c6bbf2db358476e745501349c8f3d5f0976f15c4af2a07dd62bb70291d29500ad09a354bb33e645c98a378d35544a92e9758aeb65530b1ec6e2dc8b8f9 languageName: node linkType: hard @@ -3966,7 +3987,7 @@ __metadata: languageName: node linkType: hard -"execa@npm:^5.0.0": +"execa@npm:^5.0.0, execa@npm:^5.1.1": version: 5.1.1 resolution: "execa@npm:5.1.1" dependencies: @@ -4052,7 +4073,7 @@ __metadata: languageName: node linkType: hard -"fast-glob@npm:^3.0.3, fast-glob@npm:^3.2.5, fast-glob@npm:^3.2.9": +"fast-glob@npm:^3.2.5, fast-glob@npm:^3.2.9": version: 3.3.1 resolution: "fast-glob@npm:3.3.1" dependencies: @@ -4097,6 +4118,18 @@ __metadata: languageName: node linkType: hard +"fdir@npm:^6.4.3": + version: 6.4.3 + resolution: "fdir@npm:6.4.3" + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + checksum: 10/8e6d20f4590dc168de1374a9cadaa37e20ca6e0b822aa247c230e7ea1d9e9674a68cd816146435e4ecc98f9285091462ab7e5e56eebc9510931a1794e4db68b2 + languageName: node + linkType: hard + "file-entry-cache@npm:^6.0.1": version: 6.0.1 resolution: "file-entry-cache@npm:6.0.1" @@ -4382,6 +4415,13 @@ __metadata: languageName: node linkType: hard +"get-stdin@npm:^9.0.0": + version: 9.0.0 + resolution: "get-stdin@npm:9.0.0" + checksum: 10/5972bc34d05932b45512c8e2d67b040f1c1ca8afb95c56cbc480985f2d761b7e37fe90dc8abd22527f062cc5639a6930ff346e9952ae4c11a2d4275869459594 + languageName: node + linkType: hard + "get-stream@npm:^3.0.0": version: 3.0.0 resolution: "get-stream@npm:3.0.0" @@ -4415,10 +4455,10 @@ __metadata: languageName: node linkType: hard -"git-hooks-list@npm:1.0.3": - version: 1.0.3 - resolution: "git-hooks-list@npm:1.0.3" - checksum: 10/a1dd03d39c1d727ba08a35dbdbdcc6e96de8c4170c942dc95bf787ca6e34998d39fb5295a00242b58a3d265de0b69a0686d0cf583baa6b7830f268542c4576b9 +"git-hooks-list@npm:^3.0.0": + version: 3.2.0 + resolution: "git-hooks-list@npm:3.2.0" + checksum: 10/1bc1ecd9d68c56523e96109581a7e8d2cfefc9320171dff67b0010dcc3611deff9ea32720f3eb65abfc4ba971372658f5dd118d7de458161939ba88ac8824f4f languageName: node linkType: hard @@ -4492,22 +4532,6 @@ __metadata: languageName: node linkType: hard -"globby@npm:10.0.0": - version: 10.0.0 - resolution: "globby@npm:10.0.0" - dependencies: - "@types/glob": "npm:^7.1.1" - array-union: "npm:^2.1.0" - dir-glob: "npm:^3.0.1" - fast-glob: "npm:^3.0.3" - glob: "npm:^7.1.3" - ignore: "npm:^5.1.1" - merge2: "npm:^1.2.3" - slash: "npm:^3.0.0" - checksum: 10/d0c94128706b5e12a251ddbd1b87cf0e67e57e373c816f242bb7a4a2fbe931602db1a330780d511a5bce675c25fac297622ac01d540c8479cca9c8177528947a - languageName: node - linkType: hard - "globby@npm:^11.1.0": version: 11.1.0 resolution: "globby@npm:11.1.0" @@ -5031,13 +5055,6 @@ __metadata: languageName: node linkType: hard -"is-plain-obj@npm:2.1.0": - version: 2.1.0 - resolution: "is-plain-obj@npm:2.1.0" - checksum: 10/cec9100678b0a9fe0248a81743041ed990c2d4c99f893d935545cfbc42876cbe86d207f3b895700c690ad2fa520e568c44afc1605044b535a7820c1d40e38daa - languageName: node - linkType: hard - "is-plain-obj@npm:^1.0.0": version: 1.1.0 resolution: "is-plain-obj@npm:1.1.0" @@ -5045,6 +5062,13 @@ __metadata: languageName: node linkType: hard +"is-plain-obj@npm:^4.1.0": + version: 4.1.0 + resolution: "is-plain-obj@npm:4.1.0" + checksum: 10/6dc45da70d04a81f35c9310971e78a6a3c7a63547ef782e3a07ee3674695081b6ca4e977fbb8efc48dae3375e0b34558d2bcd722aec9bddfa2d7db5b041be8ce + languageName: node + linkType: hard + "is-plain-object@npm:^5.0.0": version: 5.0.0 resolution: "is-plain-object@npm:5.0.0" @@ -5819,13 +5843,6 @@ __metadata: languageName: node linkType: hard -"line-reader@npm:^0.2.4": - version: 0.2.4 - resolution: "line-reader@npm:0.2.4" - checksum: 10/62ea55882df41938b5a5d93cfa4fdc06d263b206d7b97b0b9a1ddb10b0907debd36770931fd788c233ffcff724fd67ec15444f1f4c62e229fd8eb684991a6c62 - languageName: node - linkType: hard - "lines-and-columns@npm:^1.1.6": version: 1.1.6 resolution: "lines-and-columns@npm:1.1.6" @@ -6005,7 +6022,7 @@ __metadata: languageName: node linkType: hard -"merge2@npm:^1.2.3, merge2@npm:^1.3.0, merge2@npm:^1.4.1": +"merge2@npm:^1.3.0, merge2@npm:^1.4.1": version: 1.4.1 resolution: "merge2@npm:1.4.1" checksum: 10/7268db63ed5169466540b6fb947aec313200bcf6d40c5ab722c22e242f651994619bcd85601602972d3c85bd2cc45a358a4c61937e9f11a061919a1da569b0c2 @@ -6672,6 +6689,13 @@ __metadata: languageName: node linkType: hard +"picomatch@npm:^4.0.2": + version: 4.0.2 + resolution: "picomatch@npm:4.0.2" + checksum: 10/ce617b8da36797d09c0baacb96ca8a44460452c89362d7cb8f70ca46b4158ba8bc3606912de7c818eb4a939f7f9015cef3c766ec8a0c6bfc725fdc078e39c717 + languageName: node + linkType: hard + "pify@npm:^2.2.0": version: 2.3.0 resolution: "pify@npm:2.3.0" @@ -6738,26 +6762,27 @@ __metadata: languageName: node linkType: hard -"prettier-plugin-packagejson@npm:^2.3.0": - version: 2.3.0 - resolution: "prettier-plugin-packagejson@npm:2.3.0" +"prettier-plugin-packagejson@npm:^2.5.2": + version: 2.5.10 + resolution: "prettier-plugin-packagejson@npm:2.5.10" dependencies: - sort-package-json: "npm:1.57.0" + sort-package-json: "npm:2.15.1" + synckit: "npm:0.9.2" peerDependencies: prettier: ">= 1.16.0" peerDependenciesMeta: prettier: optional: true - checksum: 10/a00434639b6a5bb5d036451d442c86d6167397d8cba3b1916548e98b16ca673738f80df67e43a8de52754c9bd6fcc953dd82ed635f7a74895eed7db3316a1eb2 + checksum: 10/24192855a3bab72125e61a987e944301ac86cbc905f3d172a0cb954548b1f1802f821efef78afc396766f866e573692a391665e606b03dcd6ac00b5f17f68bd2 languageName: node linkType: hard -"prettier@npm:^2.7.1": - version: 2.7.1 - resolution: "prettier@npm:2.7.1" +"prettier@npm:^3.3.3": + version: 3.5.3 + resolution: "prettier@npm:3.5.3" bin: - prettier: bin-prettier.js - checksum: 10/9d29f81c1a470efca6851cd926a3e132a8d9c9d290c3d084c917c1c5aad5c392551406cf6012c724a136bd15911ede5eadc255d121c2761813b33a541a9c34c6 + prettier: bin/prettier.cjs + checksum: 10/7050c08f674d9e49fbd9a4c008291d0715471f64e94cc5e4b01729affce221dfc6875c8de7e66b728c64abc9352eefb7eaae071b5f79d30081be207b53774b78 languageName: node linkType: hard @@ -6935,13 +6960,6 @@ __metadata: languageName: node linkType: hard -"remove-markdown@npm:^0.5.0": - version: 0.5.5 - resolution: "remove-markdown@npm:0.5.5" - checksum: 10/0cb77c70ea64565ee9cfcb2f447782a02ef27885b8d131c027064f6313f9770da4ec837c53c9461cec7a13c4df50078b2544e89655bd6d4a98d50571df84c38f - languageName: node - linkType: hard - "require-directory@npm:^2.1.1": version: 2.1.1 resolution: "require-directory@npm:2.1.1" @@ -7196,6 +7214,15 @@ __metadata: languageName: node linkType: hard +"semver@npm:^7.6.0": + version: 7.7.1 + resolution: "semver@npm:7.7.1" + bin: + semver: bin/semver.js + checksum: 10/4cfa1eb91ef3751e20fc52e47a935a0118d56d6f15a837ab814da0c150778ba2ca4f1a4d9068b33070ea4273629e615066664c2cfcd7c272caf7a8a0f6518b2c + languageName: node + linkType: hard + "set-blocking@npm:^2.0.0": version: 2.0.0 resolution: "set-blocking@npm:2.0.0" @@ -7389,19 +7416,21 @@ __metadata: languageName: node linkType: hard -"sort-package-json@npm:1.57.0": - version: 1.57.0 - resolution: "sort-package-json@npm:1.57.0" +"sort-package-json@npm:2.15.1": + version: 2.15.1 + resolution: "sort-package-json@npm:2.15.1" dependencies: - detect-indent: "npm:^6.0.0" - detect-newline: "npm:3.1.0" - git-hooks-list: "npm:1.0.3" - globby: "npm:10.0.0" - is-plain-obj: "npm:2.1.0" + detect-indent: "npm:^7.0.1" + detect-newline: "npm:^4.0.0" + get-stdin: "npm:^9.0.0" + git-hooks-list: "npm:^3.0.0" + is-plain-obj: "npm:^4.1.0" + semver: "npm:^7.6.0" sort-object-keys: "npm:^1.1.3" + tinyglobby: "npm:^0.2.9" bin: sort-package-json: cli.js - checksum: 10/abc217315070ffd6559b32b95917b92c8376880c0d17b4ad2b0eeacdffb38bf723b892a56c56d91ae6999fca3369bfdf5e29b1b02b2fc944b0cbb299c069d0e8 + checksum: 10/3378565a07368e00eeb625e6b85d1edf9a3bf9f88ced32423bd3036ddb8c674fb8c0fb559044ef939e6de20bb7550423e992f4abd19cff2398d006f0fe8afc82 languageName: node linkType: hard @@ -7674,6 +7703,26 @@ __metadata: languageName: node linkType: hard +"synckit@npm:0.9.2": + version: 0.9.2 + resolution: "synckit@npm:0.9.2" + dependencies: + "@pkgr/core": "npm:^0.1.0" + tslib: "npm:^2.6.2" + checksum: 10/d45c4288be9c0232343650643892a7edafb79152c0c08d7ae5d33ca2c296b67a0e15f8cb5c9153969612c4ea5cd5686297542384aab977db23cfa6653fe02027 + languageName: node + linkType: hard + +"synckit@npm:^0.11.0": + version: 0.11.3 + resolution: "synckit@npm:0.11.3" + dependencies: + "@pkgr/core": "npm:^0.2.1" + tslib: "npm:^2.8.1" + checksum: 10/041ebcf2a36e2e121f5d52c2d48a3125a6ed0f9185501d42ff802060563d0a7555be77f466b1d706f4b85054a329d1acd13ccbc37a63825aa022e68a9551535d + languageName: node + linkType: hard + "tar@npm:^6.1.11, tar@npm:^6.1.2": version: 6.2.1 resolution: "tar@npm:6.2.1" @@ -7716,6 +7765,16 @@ __metadata: languageName: node linkType: hard +"tinyglobby@npm:^0.2.9": + version: 0.2.12 + resolution: "tinyglobby@npm:0.2.12" + dependencies: + fdir: "npm:^6.4.3" + picomatch: "npm:^4.0.2" + checksum: 10/4ad28701fa9118b32ef0e27f409e0a6c5741e8b02286d50425c1f6f71e6d6c6ded9dd5bbbbb714784b08623c4ec4d150151f1d3d996cfabe0495f908ab4f7002 + languageName: node + linkType: hard + "tmpl@npm:1.0.5": version: 1.0.5 resolution: "tmpl@npm:1.0.5" @@ -7855,6 +7914,13 @@ __metadata: languageName: node linkType: hard +"tslib@npm:^2.6.2, tslib@npm:^2.8.1": + version: 2.8.1 + resolution: "tslib@npm:2.8.1" + checksum: 10/3e2e043d5c2316461cb54e5c7fe02c30ef6dccb3384717ca22ae5c6b5bc95232a6241df19c622d9c73b809bea33b187f6dbc73030963e29950c2141bc32a79f7 + languageName: node + linkType: hard + "tsutils@npm:^3.21.0": version: 3.21.0 resolution: "tsutils@npm:3.21.0" @@ -8270,7 +8336,7 @@ __metadata: languageName: node linkType: hard -"yargs@npm:^17.3.1": +"yargs@npm:^17.0.1, yargs@npm:^17.3.1": version: 17.7.2 resolution: "yargs@npm:17.7.2" dependencies: From 38b00531f0d98d8102999a025e18efea1a5044f6 Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Mon, 7 Apr 2025 20:21:15 -0500 Subject: [PATCH 37/41] updates --- src/changelog-check.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/changelog-check.ts b/src/changelog-check.ts index c03b7236..1a7c3535 100644 --- a/src/changelog-check.ts +++ b/src/changelog-check.ts @@ -1,16 +1,6 @@ import fetch from 'node-fetch'; import { parseChangelog } from '@metamask/auto-changelog'; -// Manually define types for changelog-parser since it lacks official TypeScript support -type Release = { - version: string | null; - title: string; - date: string | null; - body: string; - parsed: Record; -}; - - /** * Asynchronously fetches the CHANGELOG.md file content from a specified GitHub repository and branch. * The function constructs a URL to access the raw content of the file using GitHub's raw content service. From a94b63b4b6186485f1a9f38a98c968bbcc606d71 Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Mon, 7 Apr 2025 20:26:07 -0500 Subject: [PATCH 38/41] lock --- package.json | 1 - yarn.lock | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/package.json b/package.json index 85970a4b..98d83a25 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,6 @@ "@octokit/rest": "^19.0.13", "@slack/web-api": "^6.0.0", "@types/luxon": "^3.3.0", - "axios": "^1.8.3", "csv-parse": "5.6.0", "googleapis": "144.0.0", "luxon": "^3.3.0", diff --git a/yarn.lock b/yarn.lock index f3bfb929..08a3da3c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1034,7 +1034,6 @@ __metadata: "@types/node-fetch": "npm:^2.6.12" "@typescript-eslint/eslint-plugin": "npm:^5.43.0" "@typescript-eslint/parser": "npm:^5.43.0" - axios: "npm:^1.8.3" csv-parse: "npm:5.6.0" depcheck: "npm:^1.4.3" eslint: "npm:^8.44.0" @@ -2478,7 +2477,7 @@ __metadata: languageName: node linkType: hard -"axios@npm:*, axios@npm:^1.7.4, axios@npm:^1.8.3": +"axios@npm:*, axios@npm:^1.7.4": version: 1.8.3 resolution: "axios@npm:1.8.3" dependencies: From 87a26846a18d548085ae7d13d8fb94cb0ccb47ba Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Mon, 7 Apr 2025 20:44:08 -0500 Subject: [PATCH 39/41] code-review-fixes --- src/changelog-check.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/changelog-check.ts b/src/changelog-check.ts index 1a7c3535..4a8c578e 100644 --- a/src/changelog-check.ts +++ b/src/changelog-check.ts @@ -78,15 +78,12 @@ async function validateChangelog( ) { console.log(`🔍 Fetching CHANGELOG.md from GitHub repository: ${repo}`); - // Fetch CHANGELOG.md from both branches - const baseChangelogContent = await fetchChangelogFromGitHub(repo, baseBranch); - const featureChangelogContent = await fetchChangelogFromGitHub( - repo, - featureBranch, - ); + const [baseChangelogContent, featureChangelogContent] = await Promise.all([ + fetchChangelogFromGitHub(repo, baseBranch), + fetchChangelogFromGitHub(repo, featureBranch), + ]); if (!featureChangelogContent) { - console.error('❌ CHANGELOG.md is missing in the feature branch.'); throw new Error('❌ CHANGELOG.md is missing in the feature branch.'); } From 633158655a2c4394a957434ec78640115213a2d7 Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Mon, 7 Apr 2025 20:57:17 -0500 Subject: [PATCH 40/41] lint --- .github/workflows/changelog-check.yml | 2 +- package.json | 2 ++ src/changelog-check.ts | 36 ++++++++++++------- .../cli.ts | 2 +- yarn.lock | 27 +++++++++++++- 5 files changed, 53 insertions(+), 16 deletions(-) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index 63307834..243ff763 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -64,7 +64,7 @@ jobs: shell: bash - name: Check Changelog - if: env.SKIP_CHANGELOG != 'true' + if: env.SKIP_CHANGELOG != 'true' id: changelog-check shell: bash env: diff --git a/package.json b/package.json index 98d83a25..06d895d0 100644 --- a/package.json +++ b/package.json @@ -28,9 +28,11 @@ "@octokit/rest": "^19.0.13", "@slack/web-api": "^6.0.0", "@types/luxon": "^3.3.0", + "axios": "^0.24.0", "csv-parse": "5.6.0", "googleapis": "144.0.0", "luxon": "^3.3.0", + "node-fetch": "2.6.12", "ora": "^5.4.1", "simple-git": "3.27.0" }, diff --git a/src/changelog-check.ts b/src/changelog-check.ts index 4a8c578e..f7624409 100644 --- a/src/changelog-check.ts +++ b/src/changelog-check.ts @@ -1,5 +1,5 @@ -import fetch from 'node-fetch'; import { parseChangelog } from '@metamask/auto-changelog'; +import nodeFetch from 'node-fetch'; /** * Asynchronously fetches the CHANGELOG.md file content from a specified GitHub repository and branch. @@ -20,9 +20,9 @@ async function fetchChangelogFromGitHub( const token = process.env.GITHUB_TOKEN ?? ''; try { - const headers = token ? { 'Authorization': `Bearer ${token}` } : {}; - const response = await fetch(url, { - headers: headers + const headers = token ? { Authorization: `Bearer ${token}` } : {}; + const response = await nodeFetch(url, { + headers, }); if (!response.ok) { @@ -33,20 +33,26 @@ async function fetchChangelogFromGitHub( } catch (error) { console.error( `❌ Error fetching CHANGELOG.md from ${branch} on ${repo}:`, - error + error, ); throw error; } } - /** - * Determines if there's a difference in the changelog entries between the base and feature branches. + * Compares the changelog entries between the base and feature branches to determine if there are differences. + * * @param baseChanges - The content of the '[Unreleased]' section from the base branch's CHANGELOG.md. * @param featureChanges - The content of the '[Unreleased]' section from the feature branch's CHANGELOG.md. + * @returns Returns true if there are new or differing number of entries in the feature branch compared to the base branch. */ -function compareChangeLogs(baseChanges: string[], featureChanges: string[]): boolean { - const newEntries = featureChanges.filter(entry => !baseChanges.includes(entry)); +function compareChangeLogs( + baseChanges: string[], + featureChanges: string[], +): boolean { + const newEntries = featureChanges.filter( + (entry) => !baseChanges.includes(entry), + ); // Log and return true if there are new entries if (newEntries.length > 0) { @@ -56,7 +62,13 @@ function compareChangeLogs(baseChanges: string[], featureChanges: string[]): boo // Check if the number of entries has changed if (baseChanges.length !== featureChanges.length) { - console.log('The number of entries has changed. Base branch has', baseChanges.length, 'entries, while feature branch has', featureChanges.length, 'entries.'); + console.log( + 'The number of entries has changed. Base branch has', + baseChanges.length, + 'entries, while feature branch has', + featureChanges.length, + 'entries.', + ); return true; } @@ -97,7 +109,6 @@ async function validateChangelog( repoUrl: '', // Not needed as we're only parsing unreleased changes }).getReleaseChanges('Unreleased'); - const baseChanges = Object.values(baseUnreleasedChanges).flat(); const featureChanges = Object.values(featureUnreleasedChanges).flat(); @@ -106,10 +117,9 @@ async function validateChangelog( console.log('Base unreleased section:', baseUnreleasedChanges); console.log('Feature unreleased section:', featureUnreleasedChanges); - const hasChanges = compareChangeLogs(baseChanges, featureChanges); - if(!hasChanges) { + if (!hasChanges) { throw new Error( "❌ No new entries detected under '## Unreleased'. Please update the changelog.", ); diff --git a/src/scripts/count-references-to-contributor-docs/cli.ts b/src/scripts/count-references-to-contributor-docs/cli.ts index 9cc60738..9a43268e 100644 --- a/src/scripts/count-references-to-contributor-docs/cli.ts +++ b/src/scripts/count-references-to-contributor-docs/cli.ts @@ -15,7 +15,7 @@ const REPOSITORY_NAMES = [ 'snaps', ] as const; -type RepositoryName = typeof REPOSITORY_NAMES[number]; +type RepositoryName = (typeof REPOSITORY_NAMES)[number]; /** * It is not necessary for us to query all of the pull requests or pull requests diff --git a/yarn.lock b/yarn.lock index 08a3da3c..2e43abca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1034,6 +1034,7 @@ __metadata: "@types/node-fetch": "npm:^2.6.12" "@typescript-eslint/eslint-plugin": "npm:^5.43.0" "@typescript-eslint/parser": "npm:^5.43.0" + axios: "npm:^0.24.0" csv-parse: "npm:5.6.0" depcheck: "npm:^1.4.3" eslint: "npm:^8.44.0" @@ -1048,6 +1049,7 @@ __metadata: jest: "npm:^28.1.3" jest-it-up: "npm:^2.0.2" luxon: "npm:^3.3.0" + node-fetch: "npm:2.6.12" ora: "npm:^5.4.1" prettier: "npm:^3.3.3" prettier-plugin-packagejson: "npm:^2.5.2" @@ -2488,6 +2490,15 @@ __metadata: languageName: node linkType: hard +"axios@npm:^0.24.0": + version: 0.24.0 + resolution: "axios@npm:0.24.0" + dependencies: + follow-redirects: "npm:^1.14.4" + checksum: 10/4c5a7a5a45c909b4ce73fbf54b1fbc52a2290fc37cc51e64f8ef2ba8ac5f76a2e369a08ddfd7ec50317528d5aa55f5987cc56fb320923ef87e1b87f8ff05b5ba + languageName: node + linkType: hard + "babel-jest@npm:^28.1.3": version: 28.1.3 resolution: "babel-jest@npm:28.1.3" @@ -4222,7 +4233,7 @@ __metadata: languageName: node linkType: hard -"follow-redirects@npm:^1.15.6": +"follow-redirects@npm:^1.14.4, follow-redirects@npm:^1.15.6": version: 1.15.9 resolution: "follow-redirects@npm:1.15.9" peerDependenciesMeta: @@ -6250,6 +6261,20 @@ __metadata: languageName: node linkType: hard +"node-fetch@npm:2.6.12": + version: 2.6.12 + resolution: "node-fetch@npm:2.6.12" + dependencies: + whatwg-url: "npm:^5.0.0" + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + checksum: 10/370ed4d906edad9709a81b54a0141d37d2973a27dc80c723d8ac14afcec6dc67bc6c70986a96992b64ec75d08159cc4b65ce6aa9063941168ea5ac73b24df9f8 + languageName: node + linkType: hard + "node-fetch@npm:^2.6.7, node-fetch@npm:^2.6.9": version: 2.7.0 resolution: "node-fetch@npm:2.7.0" From 160fa5832141b83b3d668c0d15468b7caab3079d Mon Sep 17 00:00:00 2001 From: Jake Perkins Date: Mon, 7 Apr 2025 21:02:25 -0500 Subject: [PATCH 41/41] yarn dedup --- yarn.lock | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/yarn.lock b/yarn.lock index 2e43abca..6ed11d0e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5937,15 +5937,6 @@ __metadata: languageName: node linkType: hard -"lru-cache@npm:^6.0.0": - version: 6.0.0 - resolution: "lru-cache@npm:6.0.0" - dependencies: - yallist: "npm:^4.0.0" - checksum: 10/fc1fe2ee205f7c8855fa0f34c1ab0bcf14b6229e35579ec1fd1079f31d6fc8ef8eb6fd17f2f4d99788d7e339f50e047555551ebd5e434dda503696e7c6591825 - languageName: node - linkType: hard - "lru-cache@npm:^7.7.1": version: 7.13.1 resolution: "lru-cache@npm:7.13.1" @@ -7218,14 +7209,12 @@ __metadata: languageName: node linkType: hard -"semver@npm:7.x, semver@npm:^7.0.0, semver@npm:^7.3.2, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.3.8, semver@npm:^7.5.3, semver@npm:^7.5.4": - version: 7.5.4 - resolution: "semver@npm:7.5.4" - dependencies: - lru-cache: "npm:^6.0.0" +"semver@npm:7.x, semver@npm:^7.0.0, semver@npm:^7.3.2, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.3.8, semver@npm:^7.5.3, semver@npm:^7.5.4, semver@npm:^7.6.0": + version: 7.7.1 + resolution: "semver@npm:7.7.1" bin: semver: bin/semver.js - checksum: 10/985dec0d372370229a262c737063860fabd4a1c730662c1ea3200a2f649117761a42184c96df62a0e885e76fbd5dace41087d6c1ac0351b13c0df5d6bcb1b5ac + checksum: 10/4cfa1eb91ef3751e20fc52e47a935a0118d56d6f15a837ab814da0c150778ba2ca4f1a4d9068b33070ea4273629e615066664c2cfcd7c272caf7a8a0f6518b2c languageName: node linkType: hard @@ -7238,15 +7227,6 @@ __metadata: languageName: node linkType: hard -"semver@npm:^7.6.0": - version: 7.7.1 - resolution: "semver@npm:7.7.1" - bin: - semver: bin/semver.js - checksum: 10/4cfa1eb91ef3751e20fc52e47a935a0118d56d6f15a837ab814da0c150778ba2ca4f1a4d9068b33070ea4273629e615066664c2cfcd7c272caf7a8a0f6518b2c - languageName: node - linkType: hard - "set-blocking@npm:^2.0.0": version: 2.0.0 resolution: "set-blocking@npm:2.0.0"