зеркало из https://github.com/electron/electron.git
test (do not merge): try an Azure upload with fake release data
This commit is contained in:
Родитель
84e15e2d04
Коммит
0479b2cee4
|
@ -1,44 +1,49 @@
|
|||
if (!process.env.CI) require('dotenv-safe').load();
|
||||
|
||||
const { Octokit } = require('@octokit/rest');
|
||||
const octokit = new Octokit({
|
||||
auth: process.env.ELECTRON_GITHUB_TOKEN
|
||||
});
|
||||
// const { Octokit } = require('@octokit/rest');
|
||||
// const octokit = new Octokit({
|
||||
// auth: process.env.ELECTRON_GITHUB_TOKEN
|
||||
// });
|
||||
|
||||
if (process.argv.length < 3) {
|
||||
console.log('Usage: find-release version');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const version = process.argv[2];
|
||||
const targetRepo = findRepo();
|
||||
// const version = process.argv[2];
|
||||
// const targetRepo = findRepo();
|
||||
|
||||
function findRepo () {
|
||||
if (process.env.IS_GHA_RELEASE) return 'test-releases';
|
||||
else return version.indexOf('nightly') > 0 ? 'nightlies' : 'electron';
|
||||
}
|
||||
// function findRepo () {
|
||||
// if (process.env.IS_GHA_RELEASE) return 'test-releases';
|
||||
// else return version.indexOf('nightly') > 0 ? 'nightlies' : 'electron';
|
||||
// }
|
||||
|
||||
async function findRelease () {
|
||||
const releases = await octokit.repos.listReleases({
|
||||
owner: 'electron',
|
||||
repo: targetRepo
|
||||
});
|
||||
const returnObject = {
|
||||
id: 159344706,
|
||||
draft: true,
|
||||
exists: true
|
||||
};
|
||||
// const releases = await octokit.repos.listReleases({
|
||||
// owner: 'electron',
|
||||
// repo: targetRepo
|
||||
// });
|
||||
|
||||
const targetRelease = releases.data.find(release => release.tag_name === version);
|
||||
let returnObject = {};
|
||||
// const targetRelease = releases.data.find(release => release.tag_name === version);
|
||||
// let returnObject = {};
|
||||
|
||||
if (targetRelease) {
|
||||
returnObject = {
|
||||
id: targetRelease.id,
|
||||
draft: targetRelease.draft,
|
||||
exists: true
|
||||
};
|
||||
} else {
|
||||
returnObject = {
|
||||
exists: false,
|
||||
draft: false
|
||||
};
|
||||
}
|
||||
// if (targetRelease) {
|
||||
// returnObject = {
|
||||
// id: targetRelease.id,
|
||||
// draft: targetRelease.draft,
|
||||
// exists: true
|
||||
// };
|
||||
// } else {
|
||||
// returnObject = {
|
||||
// exists: false,
|
||||
// draft: false
|
||||
// };
|
||||
// }
|
||||
console.log(JSON.stringify(returnObject));
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче