Skip to content

Commit

Permalink
fix: Fixing ocktokit api calls (twilio#211)
Browse files Browse the repository at this point in the history
* Update update-release.js
  • Loading branch information
sr010 authored and shrutiburman committed Aug 10, 2022
1 parent 79c1cc5 commit b025ba2
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions .github/scripts/update-release.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
const core = require('@actions/core');
const { GitHub } = require('@actions/github');
const { Octokit } = require("@octokit/core");

/**
* Functionality from tubone24/update_release.
* Link: https://github.com/tubone24/update_release
*/
const updateRelease = async () => {
try {
const github = new GitHub(process.env.REPO_ACCESS_TOKEN);
const octokit = new Octokit({
auth: process.env.REPO_ACCESS_TOKEN
})
const [owner, repo] = process.env.REPO_NAME ? process.env.REPO_NAME.split('/') : [null, null];
const tag = process.env.TAG_NAME;
const getReleaseResponse = await github.repos.getReleaseByTag({

//https://docs.github.com/en/rest/releases/releases#get-a-release-by-tag-name
const getReleaseResponse = await octokit.rest.repos.getReleaseByTag({
owner,
repo,
tag,
});


const {
data: {
id: oldReleaseId,
Expand Down Expand Up @@ -49,7 +54,8 @@ const updateRelease = async () => {
prerelease = oldPrerelease;
}

await github.repos.updateRelease({
//https://docs.github.com/en/rest/releases/releases#update-a-release
await octokit.rest.repos.updateRelease({
owner,
release_id: oldReleaseId,
repo,
Expand Down

0 comments on commit b025ba2

Please sign in to comment.