Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/diff-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: Dependency Diff

on:
pull_request:
types: [opened]

jobs:
diff_dependencies:
Expand All @@ -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: ./
67 changes: 36 additions & 31 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}
Expand All @@ -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)) {
Expand Down Expand Up @@ -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) {
Expand All @@ -17670,7 +17670,7 @@ var require_lib = __commonJS({
resolve(res);
}
}
this.requestRawWithCallback(info4, data, callbackForResult);
this.requestRawWithCallback(info3, data, callbackForResult);
});
});
}
Expand All @@ -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) {
Expand All @@ -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);
});
Expand All @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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,
Expand All @@ -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}.`
Expand All @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ async function run(): Promise<void> {
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)
Expand All @@ -82,6 +85,10 @@ async function run(): Promise<void> {
);
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}.`
Expand All @@ -108,6 +115,8 @@ async function run(): Promise<void> {
}
}

core.info(`Found ${newVersions.length} new package versions`);

if (newVersions.length > 0) {
const sizeWarnings: string[] = [];

Expand Down