Skip to content

Commit

Permalink
fix(github): github actions endpoint and auth (#358) thanks @meixg @h…
Browse files Browse the repository at this point in the history
  • Loading branch information
meixg authored Jan 20, 2021
1 parent 8e73bed commit 33cfa5f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/lib/github-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ async function createSecret(info) {
const response = await request({
method: 'GET',
url: `${info.github.endpoint}/repos/${owner}/${repo}/actions/secrets/public-key`,
auth: info.github,
auth: {
bearer: info.github.token,
},
headers: {'User-Agent': 'semantic-release', 'X-GitHub-OTP': info.github.code},
});
if (response.statusCode === 200) {
Expand All @@ -46,7 +48,9 @@ async function createSecret(info) {
const responsePut = await request({
method: 'PUT',
url: `${info.github.endpoint}/repos/${owner}/${repo}/actions/secrets/NPM_TOKEN`,
auth: info.github,
auth: {
bearer: info.github.token,
},
headers: {'User-Agent': 'semantic-release', 'X-GitHub-OTP': info.github.code},
json: true,
body: {
Expand Down
1 change: 1 addition & 0 deletions src/lib/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ module.exports = async function (info) {
if (!token) throw new Error('User could not supply GitHub Personal Access Token.');

info.github.token = token;
info.github.endpoint = 'https://api.github.com';
log.info('Successfully created GitHub token.');
};

0 comments on commit 33cfa5f

Please sign in to comment.