Skip to content

Commit 379fb77

Browse files
SRWieZgwleuverink
andauthored
fix: electron builder warning about GitHub token (#55)
Co-authored-by: Willem Leuverink <willem@leuver.ink>
1 parent dcf5031 commit 379fb77

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

config/nativephp.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
'token' => env('GITHUB_TOKEN'),
115115
'vPrefixedTagName' => env('GITHUB_V_PREFIXED_TAG_NAME', true),
116116
'private' => env('GITHUB_PRIVATE', false),
117+
'autoupdate_token' => env('GITHUB_AUTOUPDATE_TOKEN'), // Read-only token used by the updater for private repos
117118
'channel' => env('GITHUB_CHANNEL', 'latest'),
118119
'releaseType' => env('GITHUB_RELEASE_TYPE', 'draft'),
119120
],

src/Drivers/Electron/Updater/GitHubProvider.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,20 @@ public function environmentVariables(): array
1717

1818
public function builderOptions(): array
1919
{
20-
return [
20+
$options = [
2121
'provider' => 'github',
2222
'repo' => $this->config['repo'],
2323
'owner' => $this->config['owner'],
2424
'vPrefixedTagName' => $this->config['vPrefixedTagName'],
2525
'private' => $this->config['private'],
2626
'channel' => $this->config['channel'],
2727
'releaseType' => $this->config['releaseType'],
28-
'token' => $this->config['token'],
2928
];
29+
30+
if ($this->config['private'] === true && ! empty($this->config['autoupdate_token'])) {
31+
$options['token'] = $this->config['autoupdate_token'];
32+
}
33+
34+
return $options;
3035
}
3136
}

0 commit comments

Comments
 (0)