Skip to content

Commit

Permalink
upgrade (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
galargh committed Sep 12, 2022
1 parent f3c64a4 commit 26731c2
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions scripts/src/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,26 @@ export class GitHub {
async getRepositoryFile(repository: string, path: string) {
core.info(`Checking if ${repository}/${path} exists...`)
try {
return (
await this.client.repos.getContent({
const repo = (
await this.client.repos.get({
owner: env.GITHUB_ORG,
repo: repository,
path
repo: repository
})
).data as {path: string; url: string}
).data
if (repo.owner.login === env.GITHUB_ORG && repo.name === repository) {
return (
await this.client.repos.getContent({
owner: env.GITHUB_ORG,
repo: repository,
path
})
).data as {path: string; url: string}
} else {
core.debug(
`${env.GITHUB_ORG}/${repository} has moved to ${repo.owner.login}/${repo.name}`
)
return undefined
}
} catch (e) {
core.debug(JSON.stringify(e))
return undefined
Expand Down

0 comments on commit 26731c2

Please sign in to comment.