build: ensure consistent usage of getRepo (#44079)

This commit is contained in:
Samuel Attard 2024-10-01 13:27:02 -07:00 committed by GitHub
parent 5bdaa42b01
commit 075a297347
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,7 @@
import { Octokit } from '@octokit/rest';
import * as fs from 'node:fs';
import { createGitHubTokenStrategy } from '../github-token';
import { ELECTRON_REPO, ElectronReleaseRepo, NIGHTLY_REPO } from '../types';
if (process.argv.length < 6) {
console.log('Usage: upload-to-github filePath fileName releaseId');
@ -37,7 +38,11 @@ const getHeaders = (filePath: string, fileName: string) => {
};
};
const targetRepo = releaseVersion.indexOf('nightly') > 0 ? 'nightlies' : 'electron';
function getRepo (): ElectronReleaseRepo {
return releaseVersion.indexOf('nightly') > 0 ? NIGHTLY_REPO : ELECTRON_REPO;
}
const targetRepo = getRepo();
const uploadUrl = `https://uploads.github.com/repos/electron/${targetRepo}/releases/${releaseId}/assets{?name,label}`;
let retry = 0;