diff --git a/.github/scripts/presets_examples.mjs b/.github/scripts/presets_examples.mjs index 5c56f393..23ee8f26 100644 --- a/.github/scripts/presets_examples.mjs +++ b/.github/scripts/presets_examples.mjs @@ -14,13 +14,8 @@ console.log(`Mode: ${mode}`) const __metrics = paths.join(paths.dirname(url.fileURLToPath(import.meta.url)), "../..") const __presets = paths.join(__metrics, ".presets") -if ((!await fs.access(__presets).then(_ => true).catch(_ => false)) || (!(await fs.lstat(__presets)).isDirectory())) { - let { HEAD_REF: branch, REPO: repo } = process.env - branch = branch || "presets" - repo = repo || "lowlighter/metrics" - console.log(`cloning: ${repo}@${branch}`) - await sgit().clone(`https://github-actions[bot]:${process.env.GITHUB_TOKEN}@github.com/${repo}`, __presets, { "--branch": branch, "--single-branch": true }) -} +if ((!await fs.access(__presets).then(_ => true).catch(_ => false)) || (!(await fs.lstat(__presets)).isDirectory())) + await sgit().clone(`https://github-actions[bot]:${process.env.GITHUB_TOKEN}@github.com/lowlighter/metrics`, __presets, { "--branch": "presets", "--single-branch": true }) const git = sgit(__presets) await git.pull() const staged = new Set() @@ -37,10 +32,8 @@ action.run = async vars => child.stdout.on("data", data => stdout += data) child.stderr.on("data", data => stderr += data) child.on("close", code => { - if (code === 0) { - console.log(stdout) - return solve(stdout.match(/(?)/g)?.groups.svg ?? ``) - } + if (code === 0) + return solve(stdout.match(/(?)/)?.groups?.svg ?? ``) console.log(stdout, stderr) reject(stdout) })