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
16 changes: 13 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16019,13 +16019,13 @@ The following characters are not allowed in files that are uploaded due to limit
listEnumValues: ()=>listEnumValues,
assertNever: ()=>assert.xb,
mergeBinaryOptions: ()=>binary_format_contract.Ix,
reflectionScalarDefault: ()=>reflectionScalarDefault,
lowerCamelCase: ()=>lower_camel_case.W,
PbULong: ()=>PbULong,
LongType: ()=>reflection_info_LongType,
MessageType: ()=>MessageType,
ScalarType: ()=>reflection_info_ScalarType,
readFieldOptions: ()=>readFieldOptions,
reflectionScalarDefault: ()=>reflectionScalarDefault,
WireType: ()=>binary_format_contract.O0,
containsMessageType: ()=>containsMessageType,
listEnumNumbers: ()=>listEnumNumbers,
Expand Down Expand Up @@ -96206,6 +96206,16 @@ var __webpack_exports__ = {};
throw downloadError;
}
}
function toGitHubRedirectUrl(url) {
if (!url) return url;
if (url.startsWith('https://redirect.github.com/')) return url;
try {
const u = new URL(url);
return `https://redirect.github.com${u.pathname}${u.search}${u.hash}`;
} catch {
return url;
}
}
function formatBytes(bytes) {
if (0 === bytes) return '0 B';
const k = 1024;
Expand Down Expand Up @@ -96335,7 +96345,7 @@ var __webpack_exports__ = {};
const commitLink = `${process.env.GITHUB_SERVER_URL || 'https://github.com'}/${process.env.GITHUB_REPOSITORY}/commit/${baselineCommitHash}`;
let baselineInfo = `> 📌 **Baseline Commit:** [\`${baselineCommitHash}\`](${commitLink})`;
if (baselinePRs && baselinePRs.length > 0) {
const prLinks = baselinePRs.map((pr)=>`[#${pr.number}](${pr.url})`).join(', ');
const prLinks = baselinePRs.map((pr)=>`[#${pr.number}](${toGitHubRedirectUrl(pr.url)})`).join(', ');
baselineInfo += ` | **PR:** ${prLinks}`;
}
markdown += `${baselineInfo}\n\n`;
Expand All @@ -96357,7 +96367,7 @@ var __webpack_exports__ = {};
const commitLink = `${process.env.GITHUB_SERVER_URL || 'https://github.com'}/${process.env.GITHUB_REPOSITORY}/commit/${baselineCommitHash}`;
let baselineInfo = `> 📌 **Baseline Commit:** [\`${baselineCommitHash}\`](${commitLink})`;
if (baselinePRs && baselinePRs.length > 0) {
const prLinks = baselinePRs.map((pr)=>`[#${pr.number}](${pr.url})`).join(', ');
const prLinks = baselinePRs.map((pr)=>`[#${pr.number}](${toGitHubRedirectUrl(pr.url)})`).join(', ');
baselineInfo += ` | **PR:** ${prLinks}`;
}
await core.summary.addRaw(baselineInfo);
Expand Down
21 changes: 19 additions & 2 deletions src/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@ export interface BundleAnalysis {
}>;
}

function toGitHubRedirectUrl(url: string): string {
// Keep link clickable but avoid GitHub auto-associating PR references in comments.
// Example: https://github.com/org/repo/pull/123 -> https://redirect.github.com/org/repo/pull/123
if (!url) return url;
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function returns the falsy url value (undefined, null, or empty string) when the input is falsy. This can cause issues downstream where a string is expected. Consider returning an empty string explicitly or throwing an error for invalid inputs.

Suggested change
if (!url) return url;
if (!url) return '';

Copilot uses AI. Check for mistakes.
if (url.startsWith('https://redirect.github.com/')) return url;
try {
const u = new URL(url);
return `https://redirect.github.com${u.pathname}${u.search}${u.hash}`;
} catch {
return url;
}
}
Comment on lines +52 to +63
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new toGitHubRedirectUrl function lacks test coverage. Given that other functions in this file have comprehensive test coverage (as seen in src/tests/report.test.ts), this function should have tests covering edge cases such as empty strings, null values, invalid URLs, URLs that already use redirect.github.com, and URLs with query parameters and hashes.

Copilot uses AI. Check for mistakes.

export function formatBytes(bytes: number): string {
if (bytes === 0) return '0 B';

Expand Down Expand Up @@ -210,7 +223,9 @@ export function generateProjectMarkdown(

// Add PR links if available
if (baselinePRs && baselinePRs.length > 0) {
const prLinks = baselinePRs.map(pr => `[#${pr.number}](${pr.url})`).join(', ');
const prLinks = baselinePRs
.map(pr => `[#${pr.number}](${toGitHubRedirectUrl(pr.url)})`)
.join(', ');
baselineInfo += ` | **PR:** ${prLinks}`;
}

Expand Down Expand Up @@ -247,7 +262,9 @@ export async function generateBundleAnalysisReport(

// Add PR links if available
if (baselinePRs && baselinePRs.length > 0) {
const prLinks = baselinePRs.map(pr => `[#${pr.number}](${pr.url})`).join(', ');
const prLinks = baselinePRs
.map(pr => `[#${pr.number}](${toGitHubRedirectUrl(pr.url)})`)
.join(', ');
baselineInfo += ` | **PR:** ${prLinks}`;
}

Expand Down