Skip to content

Commit

Permalink
[ISSUE 461] Fix issue when getting the fork name for the cases where …
Browse files Browse the repository at this point in the history
…the fork has a different name
  • Loading branch information
rgdoliveira committed Oct 3, 2023
1 parent 52ecca8 commit 6636c6d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kie/build-chain-action",
"version": "3.5.4",
"version": "3.5.5",
"description": "Library to execute commands based on github projects dependencies.",
"main": "dist/index.js",
"author": "",
Expand Down
6 changes: 4 additions & 2 deletions src/service/git/git-api-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class GitAPIService {
): Promise<string> {
try {
// check whether there is a fork with the same name as repo name
const repoName = await this.checkIfRepositoryExists(targetOwner, repo);
const repoName = await this.checkIfRepositoryExists(sourceOwner, repo);

if (repoName) {
return repoName;
Expand All @@ -134,6 +134,7 @@ export class GitAPIService {
* find repo from fork list. we reach this case only if we are in the edge case where the forked repo's name is different
* from the original one
*/
this.logger.info(`Searching for a fork of ${targetOwner}/${repo} with a different name in ${sourceOwner}`);
const forkName = (
await this.client
.rest(targetOwner, repo)
Expand All @@ -144,6 +145,7 @@ export class GitAPIService {
})
).data;
if (forkName) {
this.logger.info(`Found ${sourceOwner}/${forkName} repository as a fork of ${targetOwner}/${repo}`);
return forkName;
}
}
Expand Down Expand Up @@ -202,7 +204,7 @@ export class GitAPIService {
});
return repo;
} catch (err) {
this.logger.error(
this.logger.info(
this.getErrorMessage(err, `Failed to get ${owner}/${repo}.`)
);
return undefined;
Expand Down

0 comments on commit 6636c6d

Please sign in to comment.