Skip to content

Commit 9ab3a37

Browse files
committed
WIP
1 parent e9754ba commit 9ab3a37

File tree

2 files changed

+30
-37
lines changed

2 files changed

+30
-37
lines changed

dist/index.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,47 @@
1-
import * as core from '@actions/core';
2-
import { installCli } from './steps/installCli';
3-
import { runChecksJson } from './steps/runChecksJson';
4-
import { runChecksText } from './steps/runChecksText';
5-
import { getConfigContents } from './steps/getConfigContents';
6-
import { getFileDiff } from './steps/getFileDiff';
7-
import { addAnnotations } from './addAnnotations';
8-
import * as semver from 'semver';
1+
import * as core from "@actions/core";
2+
import { installCli } from "./steps/installCli";
3+
import { runChecksJson } from "./steps/runChecksJson";
4+
import { runChecksText } from "./steps/runChecksText";
5+
import { getConfigContents } from "./steps/getConfigContents";
6+
import { getFileDiff } from "./steps/getFileDiff";
7+
import { addAnnotations } from "./addAnnotations";
8+
import * as semver from "semver";
9+
import { getExecOutput } from "@actions/exec";
910

1011
async function run() {
1112
const cwd = process.cwd();
1213
const shopifyExecutable = `${cwd}/node_modules/.bin/shopify`;
1314

1415
// This is mockable with process.env.INPUT_ALL_CAPS_NAME
15-
const themeRoot = core.getInput('theme_root') || cwd;
16-
const version = core.getInput('version') || '';
17-
const flags = core.getInput('flags') || '';
18-
const ghToken = core.getInput('token');
19-
const base = core.getInput('base');
16+
const themeRoot = core.getInput("theme_root") || cwd;
17+
const version = core.getInput("version") || "";
18+
const flags = core.getInput("flags") || "";
19+
const ghToken = core.getInput("token");
20+
const base = core.getInput("base");
2021
const devPreview = requiresDevPreview(version);
2122

2223
try {
24+
const { exitCode, stdout, stderr } = await getExecOutput(
25+
`which ${shopifyExecutable}`
26+
);
27+
console.log({ exitCode, stdout, stderr });
2328
await installCli(version);
2429
if (ghToken) {
25-
const [{ report, exitCode }, configContent, fileDiff] =
26-
await Promise.all([
27-
runChecksJson(
28-
themeRoot,
29-
shopifyExecutable,
30-
devPreview,
31-
flags,
32-
),
30+
const [{ report, exitCode }, configContent, fileDiff] = await Promise.all(
31+
[
32+
runChecksJson(themeRoot, shopifyExecutable, devPreview, flags),
3333
getConfigContents(themeRoot, shopifyExecutable, devPreview),
3434
getFileDiff(base, cwd),
35-
]);
36-
await addAnnotations(
37-
report,
38-
exitCode,
39-
configContent,
40-
ghToken,
41-
fileDiff,
35+
]
4236
);
37+
await addAnnotations(report, exitCode, configContent, ghToken, fileDiff);
4338
process.exit(exitCode);
4439
} else {
4540
const { exitCode } = await runChecksText(
4641
themeRoot,
4742
shopifyExecutable,
4843
devPreview,
49-
flags,
44+
flags
5045
);
5146
process.exit(exitCode);
5247
}
@@ -58,9 +53,7 @@ async function run() {
5853

5954
function requiresDevPreview(version: string) {
6055
return (
61-
!!version &&
62-
semver.gte(version, '3.50.0') &&
63-
semver.lt(version, '3.55.0')
56+
!!version && semver.gte(version, "3.50.0") && semver.lt(version, "3.55.0")
6457
);
6558
}
6659

0 commit comments

Comments
 (0)