Skip to content

Commit ec3f647

Browse files
committed
@actions doesn't work on deno, roll our own
1 parent 98b6abe commit ec3f647

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

src/import_map.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"encoding/": "jsr:/@std/[email protected]/",
77
"fmt/": "jsr:/@std/[email protected]/",
88
"fs/": "jsr:/@std/[email protected]/",
9-
"github_actions/core": "npm:@actions/[email protected]",
109
"http/": "jsr:/@std/[email protected]/",
1110
"path": "jsr:@std/[email protected]",
1211
"path/posix": "jsr:@std/[email protected]/posix",

src/tools/github.ts

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66

77
import { 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+
3051
export 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
}

0 commit comments

Comments
 (0)