|
1 |
| -const Core = require("@actions/core"); |
2 |
| -const ToolCache = require("@actions/tool-cache"); |
3 |
| -const Cache = require("@actions/cache"); |
4 |
| -const IO = require("@actions/io"); |
5 |
| -const Glob = require("@actions/glob"); |
6 |
| -const {Octokit} = require("@octokit/rest"); |
7 |
| -const fetch = require("node-fetch"); |
8 |
| -const Path = require("path"); |
9 |
| -const ChildProcess = require("child_process"); |
10 |
| -const Util = require("util"); |
11 |
| -const FS = require("fs").promises; |
12 |
| - |
13 |
| -const {cmpTags} = require("tag-cmp"); |
| 1 | +import Core from "@actions/core"; |
| 2 | +import ToolCache from "@actions/tool-cache"; |
| 3 | +import Cache from "@actions/cache"; |
| 4 | +import IO from "@actions/io"; |
| 5 | +import Glob from "@actions/glob"; |
| 6 | +import {Octokit} from "@octokit/rest"; |
| 7 | +import fetch from "node-fetch"; |
| 8 | +import Path from "path"; |
| 9 | +import ChildProcess from "child_process"; |
| 10 | +import Util from "util"; |
| 11 | +import URL from "url"; |
| 12 | +import {promises as FS} from "fs"; |
| 13 | + |
| 14 | +import {cmpTags} from "tag-cmp"; |
14 | 15 | const execFile = Util.promisify(ChildProcess.execFile);
|
15 | 16 |
|
16 | 17 | async function run() {
|
@@ -53,7 +54,8 @@ async function run() {
|
53 | 54 | Core.info(stdout);
|
54 | 55 |
|
55 | 56 | if (!Core.getInput("annotate") || Core.getBooleanInput("annotate")) {
|
56 |
| - const matchersPath = Path.join(__dirname, ".github"); |
| 57 | + const scriptDir = Path.dirname(URL.fileURLToPath(import.meta.url)); |
| 58 | + const matchersPath = Path.join(scriptDir, ".github"); |
57 | 59 | Core.info(`::add-matcher::${Path.join(matchersPath, "crystal.json")}`);
|
58 | 60 | Core.info(`::add-matcher::${Path.join(matchersPath, "crystal-spec.json")}`);
|
59 | 61 | }
|
@@ -466,6 +468,4 @@ async function onlySubdir(path) {
|
466 | 468 | return path;
|
467 | 469 | }
|
468 | 470 |
|
469 |
| -if (require.main === module) { |
470 |
| - run(); |
471 |
| -} |
| 471 | +run(); |
0 commit comments