From a634787b7ae275962337b4d96ae3556bda62841c Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Thu, 25 Sep 2025 16:14:03 +0100 Subject: [PATCH 1/8] chore: bump github action version sha --- .github/workflows/diff-dependencies.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/diff-dependencies.yml b/.github/workflows/diff-dependencies.yml index 5b482b6..63cff5c 100644 --- a/.github/workflows/diff-dependencies.yml +++ b/.github/workflows/diff-dependencies.yml @@ -11,6 +11,6 @@ jobs: pull-requests: write steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Create Diff uses: e18e/action-dependency-diff@main From 95127f0d09ce0475f34a5cb06acf00e28be51264 Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Thu, 25 Sep 2025 16:18:25 +0100 Subject: [PATCH 2/8] fix: run diff on every push --- .github/workflows/diff-dependencies.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/diff-dependencies.yml b/.github/workflows/diff-dependencies.yml index 63cff5c..a292149 100644 --- a/.github/workflows/diff-dependencies.yml +++ b/.github/workflows/diff-dependencies.yml @@ -2,7 +2,6 @@ name: Dependency Diff on: pull_request: - types: [opened] jobs: diff_dependencies: From bf7a5024356cb4e1baffcb03ef7827bba4f2d3bd Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Thu, 25 Sep 2025 16:20:05 +0100 Subject: [PATCH 3/8] chore: try this --- src/git.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/git.ts b/src/git.ts index f301a8b..9c15805 100644 --- a/src/git.ts +++ b/src/git.ts @@ -24,12 +24,14 @@ export function getBaseRef(): string { const inputBaseRef = core.getInput('base-ref'); if (inputBaseRef) { + core.info('Found input base ref: ' + inputBaseRef); return inputBaseRef.includes('/') ? inputBaseRef : `origin/${inputBaseRef}`; } const githubBaseRef = github.context.payload.pull_request?.base.ref; if (githubBaseRef) { + core.info('Found github base ref: ' + githubBaseRef); return `origin/${githubBaseRef}`; } From 9afae3d5b435ad10d9793520496ce8374c1b1354 Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Thu, 25 Sep 2025 16:22:17 +0100 Subject: [PATCH 4/8] wip: use local action --- .github/workflows/diff-dependencies.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/diff-dependencies.yml b/.github/workflows/diff-dependencies.yml index a292149..2b5d6bf 100644 --- a/.github/workflows/diff-dependencies.yml +++ b/.github/workflows/diff-dependencies.yml @@ -12,4 +12,4 @@ jobs: - name: Checkout repository uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Create Diff - uses: e18e/action-dependency-diff@main + uses: ./ From b16a6111285150244678f17416f69bbace920c43 Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Thu, 25 Sep 2025 16:29:51 +0100 Subject: [PATCH 5/8] chore: rebuild --- main.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.js b/main.js index 3984248..0045e48 100644 --- a/main.js +++ b/main.js @@ -24147,10 +24147,12 @@ function getFileFromRef(ref, filePath, cwd2) { function getBaseRef() { const inputBaseRef = core.getInput("base-ref"); if (inputBaseRef) { + core.info("Found input base ref: " + inputBaseRef); return inputBaseRef.includes("/") ? inputBaseRef : `origin/${inputBaseRef}`; } const githubBaseRef = github.context.payload.pull_request?.base.ref; if (githubBaseRef) { + core.info("Found github base ref: " + githubBaseRef); return `origin/${githubBaseRef}`; } return "origin/main"; From f8ca18c51418c1650b8971ff9919ed5bfd95a184 Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Thu, 25 Sep 2025 16:36:38 +0100 Subject: [PATCH 6/8] wip: try this one --- .github/workflows/diff-dependencies.yml | 2 ++ main.js | 2 -- src/git.ts | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/diff-dependencies.yml b/.github/workflows/diff-dependencies.yml index 2b5d6bf..c73f07a 100644 --- a/.github/workflows/diff-dependencies.yml +++ b/.github/workflows/diff-dependencies.yml @@ -11,5 +11,7 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + fetch-depth: 0 - name: Create Diff uses: ./ diff --git a/main.js b/main.js index 0045e48..3984248 100644 --- a/main.js +++ b/main.js @@ -24147,12 +24147,10 @@ function getFileFromRef(ref, filePath, cwd2) { function getBaseRef() { const inputBaseRef = core.getInput("base-ref"); if (inputBaseRef) { - core.info("Found input base ref: " + inputBaseRef); return inputBaseRef.includes("/") ? inputBaseRef : `origin/${inputBaseRef}`; } const githubBaseRef = github.context.payload.pull_request?.base.ref; if (githubBaseRef) { - core.info("Found github base ref: " + githubBaseRef); return `origin/${githubBaseRef}`; } return "origin/main"; diff --git a/src/git.ts b/src/git.ts index 9c15805..f301a8b 100644 --- a/src/git.ts +++ b/src/git.ts @@ -24,14 +24,12 @@ export function getBaseRef(): string { const inputBaseRef = core.getInput('base-ref'); if (inputBaseRef) { - core.info('Found input base ref: ' + inputBaseRef); return inputBaseRef.includes('/') ? inputBaseRef : `origin/${inputBaseRef}`; } const githubBaseRef = github.context.payload.pull_request?.base.ref; if (githubBaseRef) { - core.info('Found github base ref: ' + githubBaseRef); return `origin/${githubBaseRef}`; } From 9bd24f66d7f11494bb7ae02d660952d22464f09a Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Thu, 25 Sep 2025 16:43:33 +0100 Subject: [PATCH 7/8] fix: remove extra logging --- main.js | 61 +++++++++++++++++++++++++++--------------------------- src/git.ts | 3 +-- 2 files changed, 31 insertions(+), 33 deletions(-) diff --git a/main.js b/main.js index 3984248..9b25a9b 100644 --- a/main.js +++ b/main.js @@ -17590,12 +17590,12 @@ var require_lib = __commonJS({ throw new Error("Client has already been disposed."); } const parsedUrl = new URL(requestUrl); - let info4 = this._prepareRequest(verb, parsedUrl, headers); + let info3 = this._prepareRequest(verb, parsedUrl, headers); const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb) ? this._maxRetries + 1 : 1; let numTries = 0; let response; do { - response = yield this.requestRaw(info4, data); + response = yield this.requestRaw(info3, data); if (response && response.message && response.message.statusCode === HttpCodes.Unauthorized) { let authenticationHandler; for (const handler of this.handlers) { @@ -17605,7 +17605,7 @@ var require_lib = __commonJS({ } } if (authenticationHandler) { - return authenticationHandler.handleAuthentication(this, info4, data); + return authenticationHandler.handleAuthentication(this, info3, data); } else { return response; } @@ -17628,8 +17628,8 @@ var require_lib = __commonJS({ } } } - info4 = this._prepareRequest(verb, parsedRedirectUrl, headers); - response = yield this.requestRaw(info4, data); + info3 = this._prepareRequest(verb, parsedRedirectUrl, headers); + response = yield this.requestRaw(info3, data); redirectsRemaining--; } if (!response.message.statusCode || !HttpResponseRetryCodes.includes(response.message.statusCode)) { @@ -17658,7 +17658,7 @@ var require_lib = __commonJS({ * @param info * @param data */ - requestRaw(info4, data) { + requestRaw(info3, data) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => { function callbackForResult(err, res) { @@ -17670,7 +17670,7 @@ var require_lib = __commonJS({ resolve(res); } } - this.requestRawWithCallback(info4, data, callbackForResult); + this.requestRawWithCallback(info3, data, callbackForResult); }); }); } @@ -17680,12 +17680,12 @@ var require_lib = __commonJS({ * @param data * @param onResult */ - requestRawWithCallback(info4, data, onResult) { + requestRawWithCallback(info3, data, onResult) { if (typeof data === "string") { - if (!info4.options.headers) { - info4.options.headers = {}; + if (!info3.options.headers) { + info3.options.headers = {}; } - info4.options.headers["Content-Length"] = Buffer.byteLength(data, "utf8"); + info3.options.headers["Content-Length"] = Buffer.byteLength(data, "utf8"); } let callbackCalled = false; function handleResult(err, res) { @@ -17694,7 +17694,7 @@ var require_lib = __commonJS({ onResult(err, res); } } - const req = info4.httpModule.request(info4.options, (msg) => { + const req = info3.httpModule.request(info3.options, (msg) => { const res = new HttpClientResponse(msg); handleResult(void 0, res); }); @@ -17706,7 +17706,7 @@ var require_lib = __commonJS({ if (socket) { socket.end(); } - handleResult(new Error(`Request timeout: ${info4.options.path}`)); + handleResult(new Error(`Request timeout: ${info3.options.path}`)); }); req.on("error", function(err) { handleResult(err); @@ -17742,27 +17742,27 @@ var require_lib = __commonJS({ return this._getProxyAgentDispatcher(parsedUrl, proxyUrl); } _prepareRequest(method, requestUrl, headers) { - const info4 = {}; - info4.parsedUrl = requestUrl; - const usingSsl = info4.parsedUrl.protocol === "https:"; - info4.httpModule = usingSsl ? https : http; + const info3 = {}; + info3.parsedUrl = requestUrl; + const usingSsl = info3.parsedUrl.protocol === "https:"; + info3.httpModule = usingSsl ? https : http; const defaultPort = usingSsl ? 443 : 80; - info4.options = {}; - info4.options.host = info4.parsedUrl.hostname; - info4.options.port = info4.parsedUrl.port ? parseInt(info4.parsedUrl.port) : defaultPort; - info4.options.path = (info4.parsedUrl.pathname || "") + (info4.parsedUrl.search || ""); - info4.options.method = method; - info4.options.headers = this._mergeHeaders(headers); + info3.options = {}; + info3.options.host = info3.parsedUrl.hostname; + info3.options.port = info3.parsedUrl.port ? parseInt(info3.parsedUrl.port) : defaultPort; + info3.options.path = (info3.parsedUrl.pathname || "") + (info3.parsedUrl.search || ""); + info3.options.method = method; + info3.options.headers = this._mergeHeaders(headers); if (this.userAgent != null) { - info4.options.headers["user-agent"] = this.userAgent; + info3.options.headers["user-agent"] = this.userAgent; } - info4.options.agent = this._getAgent(info4.parsedUrl); + info3.options.agent = this._getAgent(info3.parsedUrl); if (this.handlers) { for (const handler of this.handlers) { - handler.prepareRequest(info4.options); + handler.prepareRequest(info3.options); } } - return info4; + return info3; } _mergeHeaders(headers) { if (this.requestOptions && this.requestOptions.headers) { @@ -19752,10 +19752,10 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); (0, command_1.issueCommand)("notice", (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message); } exports.notice = notice; - function info4(message) { + function info3(message) { process.stdout.write(message + os.EOL); } - exports.info = info4; + exports.info = info3; function startGroup(name) { (0, command_1.issue)("group", name); } @@ -24139,8 +24139,7 @@ function getFileFromRef(ref, filePath, cwd2) { stdio: "pipe" }); return content; - } catch (err) { - core.info(`Could not get ${filePath} from ${ref}: ${err}`); + } catch { return null; } } diff --git a/src/git.ts b/src/git.ts index f301a8b..332aae1 100644 --- a/src/git.ts +++ b/src/git.ts @@ -14,8 +14,7 @@ export function getFileFromRef( stdio: 'pipe' }); return content; - } catch (err) { - core.info(`Could not get ${filePath} from ${ref}: ${err}`); + } catch { return null; } } From 9719ae672b1ea529ad2ad2a692e72bd572e73253 Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Thu, 25 Sep 2025 16:45:57 +0100 Subject: [PATCH 8/8] chore: add useful logs --- main.js | 6 ++++++ src/main.ts | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/main.js b/main.js index 9b25a9b..d3bfe0c 100644 --- a/main.js +++ b/main.js @@ -24227,6 +24227,8 @@ async function run() { core3.getInput("size-threshold") || "100000", 10 ); + core3.info(`Dependency threshold set to ${dependencyThreshold}`); + core3.info(`Size threshold set to ${formatBytes(sizeThreshold)}`); const messages = []; const currentDepCount = Array.from(currentDeps.values()).reduce( (sum, versions) => sum + versions.size, @@ -24237,6 +24239,9 @@ async function run() { 0 ); const depIncrease = currentDepCount - baseDepCount; + core3.info(`Base dependency count: ${baseDepCount}`); + core3.info(`Current dependency count: ${currentDepCount}`); + core3.info(`Dependency count increase: ${depIncrease}`); if (depIncrease >= dependencyThreshold) { messages.push( `\u26A0\uFE0F **Dependency Count Warning**: This PR adds ${depIncrease} new dependencies (${baseDepCount} \u2192 ${currentDepCount}), which exceeds the threshold of ${dependencyThreshold}.` @@ -24255,6 +24260,7 @@ async function run() { } } } + core3.info(`Found ${newVersions.length} new package versions`); if (newVersions.length > 0) { const sizeWarnings = []; for (const dep of newVersions) { diff --git a/src/main.ts b/src/main.ts index 177dd05..cdec0ce 100644 --- a/src/main.ts +++ b/src/main.ts @@ -69,6 +69,9 @@ async function run(): Promise { 10 ); + core.info(`Dependency threshold set to ${dependencyThreshold}`); + core.info(`Size threshold set to ${formatBytes(sizeThreshold)}`); + const messages: string[] = []; // Count total dependencies (all package-version combinations) @@ -82,6 +85,10 @@ async function run(): Promise { ); const depIncrease = currentDepCount - baseDepCount; + core.info(`Base dependency count: ${baseDepCount}`); + core.info(`Current dependency count: ${currentDepCount}`); + core.info(`Dependency count increase: ${depIncrease}`); + if (depIncrease >= dependencyThreshold) { messages.push( `⚠️ **Dependency Count Warning**: This PR adds ${depIncrease} new dependencies (${baseDepCount} → ${currentDepCount}), which exceeds the threshold of ${dependencyThreshold}.` @@ -108,6 +115,8 @@ async function run(): Promise { } } + core.info(`Found ${newVersions.length} new package versions`); + if (newVersions.length > 0) { const sizeWarnings: string[] = [];