From 95bb0ba0017d75dd53524776181cb008679d5743 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Sun, 30 May 2021 17:22:33 -0700 Subject: [PATCH] fix: use default_branch in release-notes (#29415) --- script/release/notes/index.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/script/release/notes/index.js b/script/release/notes/index.js index 2e6ba99ffe..644b76490f 100755 --- a/script/release/notes/index.js +++ b/script/release/notes/index.js @@ -8,6 +8,11 @@ const semver = require('semver'); const { ELECTRON_DIR } = require('../../lib/utils'); const notesGenerator = require('./notes.js'); +const { Octokit } = require('@octokit/rest'); +const octokit = new Octokit({ + auth: process.env.ELECTRON_GITHUB_TOKEN +}); + const semverify = version => version.replace(/^origin\//, '').replace(/[xy]/g, '0').replace(/-/g, '.'); const runGit = async (args) => { @@ -37,8 +42,12 @@ const getTagsOf = async (point) => { }; const getTagsOnBranch = async (point) => { - const mainTags = await getTagsOf('main'); - if (point === 'main') { + const { data: { default_branch: defaultBranch } } = await octokit.repos.get({ + owner: 'electron', + repo: 'electron' + }); + const mainTags = await getTagsOf(defaultBranch); + if (point === defaultBranch) { return mainTags; }