Skip to content

Commit

Permalink
fix: add custom channel in github provider (#8393)
Browse files Browse the repository at this point in the history
  • Loading branch information
beyondkmp committed Aug 8, 2024
1 parent 12c52a8 commit 8dabf64
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/clean-trainers-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"electron-updater": patch
---

add custom channel in github provider
10 changes: 9 additions & 1 deletion packages/electron-updater/src/providers/GitHubProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ export class GitHubProvider extends BaseGitHubProvider<GithubUpdateInfo> {
super(options, "github.com", runtimeOptions)
}

private get channel(): string {
const result = this.updater.channel || this.options.channel
return result == null ? this.getDefaultChannelName() : this.getCustomChannelName(result)
}

async getLatestVersion(): Promise<GithubUpdateInfo> {
const cancellationToken = new CancellationToken()

Expand Down Expand Up @@ -136,7 +141,10 @@ export class GitHubProvider extends BaseGitHubProvider<GithubUpdateInfo> {
}

try {
const channel = this.updater.allowPrerelease ? this.getCustomChannelName(String(semver.prerelease(tag)?.[0] || "latest")) : this.getDefaultChannelName()
let channel = this.channel
if (this.updater.allowPrerelease && semver.prerelease(tag)?.[0]) {
channel = this.getCustomChannelName(String(semver.prerelease(tag)?.[0]))
}
rawData = await fetchData(channel)
} catch (e: any) {
if (this.updater.allowPrerelease) {
Expand Down

0 comments on commit 8dabf64

Please sign in to comment.