Fix for open changes action (#2363)

This commit is contained in:
Osvaldo Ortega
2025-12-04 02:05:09 +00:00
committed by GitHub
parent 8e2209b56f
commit 02917daf5b
@@ -32,13 +32,21 @@ export class PullRequestFileChangesService implements IPullRequestFileChangesSer
try {
this.logService.trace(`Getting file changes for PR #${pullRequest.number}`);
const repoId = await getRepoId(this._gitService);
if (!repoId) {
let repoName, repoOwner = undefined;
if (repoId) {
repoName = repoId.repo;
repoOwner = repoId.org;
} else {
repoOwner = pullRequest.repository.owner.login;
repoName = pullRequest.repository.name;
}
if (!repoName || !repoOwner) {
this.logService.warn('No repo ID available for fetching PR file changes');
return undefined;
}
this.logService.trace(`Fetching PR files from ${repoId.org}/${repoId.repo} for PR #${pullRequest.number}`);
const files = await this._octoKitService.getPullRequestFiles(repoId.org, repoId.repo, pullRequest.number);
this.logService.trace(`Fetching PR files from ${repoOwner}/${repoName} for PR #${pullRequest.number}`);
const files = await this._octoKitService.getPullRequestFiles(repoOwner, repoName, pullRequest.number);
this.logService.trace(`Got ${files?.length || 0} files from API`);
if (!files || files.length === 0) {
@@ -62,8 +70,8 @@ export class PullRequestFileChangesService implements IPullRequestFileChangesSer
const originalUri = toPRContentUri(
file.previous_filename || file.filename,
{
owner: repoId.org,
repo: repoId.repo,
owner: repoOwner,
repo: repoName,
prNumber: pullRequest.number,
commitSha: pullRequest.baseRefOid,
isBase: true,
@@ -75,8 +83,8 @@ export class PullRequestFileChangesService implements IPullRequestFileChangesSer
const modifiedUri = toPRContentUri(
file.filename,
{
owner: repoId.org,
repo: repoId.repo,
owner: repoOwner,
repo: repoName,
prNumber: pullRequest.number,
commitSha: pullRequest.headRefOid,
isBase: false,