File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 "encoding/" : " jsr:/@std/encoding@1.0.9/" ,
77 "fmt/" : " jsr:/@std/fmt@1.0.6/" ,
88 "fs/" : " jsr:/@std/fs@1.0.16/" ,
9- "github_actions/core" : " npm:@actions/core@1.11.1" ,
109 "http/" : " jsr:/@std/http@1.0.14/" ,
1110 "path" : " jsr:@std/path@1.0.8" ,
1211 "path/posix" : " jsr:@std/path@1.0.8/posix" ,
Original file line number Diff line number Diff line change 55 */
66
77import { GitHubRelease } from "./types.ts" ;
8- import * as core from "github_actions/core" ;
98
109// deno-lint-ignore-file camelcase
1110
@@ -27,10 +26,37 @@ export async function getLatestRelease(repo: string): Promise<GitHubRelease> {
2726 }
2827}
2928
29+ // NB we do not escape these here - it's the caller's responsibility to do so
30+ function githubActionsWorkflowCommand (
31+ command : string ,
32+ value = "" ,
33+ params ?: Record < string , string > ,
34+ ) {
35+ let paramsStr = "" ;
36+ if ( params ) {
37+ paramsStr = " " ;
38+ let first = false ;
39+ for ( const [ key , val ] of Object . entries ( params ) ) {
40+ if ( ! first ) {
41+ first = true ;
42+ } else {
43+ paramsStr += "," ;
44+ }
45+ paramsStr += `${ key } =${ val } ` ;
46+ }
47+ }
48+ return `::${ command } ${ paramsStr } ::${ value } ` ;
49+ }
50+
3051export async function group < T > ( title : string , fn : ( ) => Promise < T > ) {
3152 Deno . env . get ( "CI" ) ;
3253 if ( ! Deno . env . get ( "CI" ) ) {
3354 return fn ( ) ;
3455 }
35- return core . group ( title , fn ) ;
56+ console . log ( githubActionsWorkflowCommand ( "group" , title ) ) ;
57+ try {
58+ return await fn ( ) ;
59+ } finally {
60+ console . log ( githubActionsWorkflowCommand ( "endgroup" ) ) ;
61+ }
3662}
You can’t perform that action at this time.
0 commit comments