fix: fix gh repository configuration

This commit is contained in:
tdurieux
2024-04-02 14:46:45 +01:00
parent fa2591fe38
commit 73019c1b44
+10 -5
View File
@@ -72,21 +72,24 @@ export default class Repository {
} }
get source() { get source() {
const ghRepo = new GitHubRepository({
name: this.model.source.repositoryName,
});
switch (this.model.source.type) { switch (this.model.source.type) {
case "GitHubDownload": case "GitHubDownload":
return new GitHubDownload({ return new GitHubDownload({
repoId: this.repoId, repoId: this.repoId,
commit: this.model.source.commit || "HEAD", commit: this.model.source.commit || "HEAD",
organization: "", organization: ghRepo.owner,
repoName: this.model.source.repositoryName || "", repoName: ghRepo.repo,
getToken: () => this.getToken(), getToken: () => this.getToken(),
}); });
case "GitHubStream": case "GitHubStream":
return new GitHubStream({ return new GitHubStream({
repoId: this.repoId, repoId: this.repoId,
commit: this.model.source.commit || "HEAD", commit: this.model.source.commit || "HEAD",
organization: "", organization: ghRepo.owner,
repoName: this.model.source.repositoryName || "", repoName: ghRepo.repo,
getToken: () => this.getToken(), getToken: () => this.getToken(),
}); });
case "Zip": case "Zip":
@@ -235,7 +238,9 @@ export default class Repository {
// Only GitHubBase can be update for the moment // Only GitHubBase can be update for the moment
if (this.source instanceof GitHubBase) { if (this.source instanceof GitHubBase) {
const token = await this.getToken(); const token = await this.getToken();
const ghRepo = new GitHubRepository({}); const ghRepo = new GitHubRepository({
name: this.model.source.repositoryName,
});
const branches = await ghRepo.branches({ const branches = await ghRepo.branches({
force: true, force: true,
accessToken: token, accessToken: token,