diff --git a/.github/workflows/diff-dependencies.yml b/.github/workflows/diff-dependencies.yml index 5b482b6..c73f07a 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: @@ -11,6 +10,8 @@ jobs: pull-requests: write steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + fetch-depth: 0 - name: Create Diff - uses: e18e/action-dependency-diff@main + uses: ./ diff --git a/main.js b/main.js index 3984248..d3bfe0c 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; } } @@ -24228,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, @@ -24238,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}.` @@ -24256,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/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; } } 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[] = [];