File tree Expand file tree Collapse file tree 2 files changed +12
-12
lines changed
Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change 11export * as colors from "jsr:@std/fmt@1.0.3/colors" ;
22export * as semver from "jsr:@std/semver@1.0.3" ;
3- export { Octokit } from "npm:@octokit/core@6.1.2" ;
4- export { restEndpointMethods } from "npm:@octokit/plugin-rest-endpoint-methods@13.2.6" ;
3+ export { request } from "npm:@octokit/request@9.1.3" ;
54export { default as parseRepo } from "npm:parse-repo@1.0.4" ;
65export { run } from "jsr:@hugojosefson/run-simple@2.3.7" ;
76export { assert } from "jsr:@std/assert@1.0.8" ;
Original file line number Diff line number Diff line change 1- import { Octokit , restEndpointMethods } from "./deps.ts" ;
1+ import { request } from "./deps.ts" ;
22import git from "./git.ts" ;
33
44export interface Commits {
@@ -50,23 +50,24 @@ export default {
5050 async release ( nextVer : string , commits : Commits ) : Promise < string > {
5151 const { owner, repo } = await git . repoInfo ( ) ;
5252
53- const restOctokit = Octokit . plugin ( restEndpointMethods ) ;
54- const octokit = new restOctokit ( {
55- auth : Deno . env . get ( "GITHUB_TOKEN" ) ,
56- } ) ;
53+ // Get the GitHub token from environment variables
54+ const token = Deno . env . get ( "GITHUB_TOKEN" ) ;
55+ if ( ! token ) {
56+ throw new Error ( "GITHUB_TOKEN environment variable is not set." ) ;
57+ }
5758
58- const res = await octokit . rest . repos . createRelease ( {
59+ // Create a new release using the 'request' function
60+ const res = await request ( "POST /repos/{owner}/{repo}/releases" , {
61+ headers : {
62+ authorization : `token ${ token } ` ,
63+ } ,
5964 owner,
6065 repo,
6166 name : nextVer ,
6267 tag_name : nextVer ,
6368 body : generateNotes ( nextVer , commits ) ,
6469 } ) ;
6570
66- if ( res . status !== 201 ) {
67- throw new Error ( `GitHub release failed: ${ res . status } ` ) ;
68- }
69-
7071 return res . data . html_url ;
7172 } ,
7273} ;
You can’t perform that action at this time.
0 commit comments