diff --git a/.github/scripts/presets_examples.mjs b/.github/scripts/presets_examples.mjs index 614cfe9b..534f7c07 100644 --- a/.github/scripts/presets_examples.mjs +++ b/.github/scripts/presets_examples.mjs @@ -14,8 +14,13 @@ 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())) - await sgit().clone(`https://github-actions[bot]:${process.env.GITHUB_TOKEN}@github.com/lowlighter/metrics`, __presets, { "--branch": process.env.HEAD_REF || "presets", "--single-branch": true }) +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 }) +} const git = sgit(__presets) await git.pull() const staged = new Set() diff --git a/.github/workflows/branches.yml b/.github/workflows/branches.yml index f3a5d761..471878d0 100644 --- a/.github/workflows/branches.yml +++ b/.github/workflows/branches.yml @@ -1,7 +1,7 @@ name: Check automated branches on: - pull_request: + pull_request_target: branches: - main - latest diff --git a/.github/workflows/test.presets.yml b/.github/workflows/test.presets.yml index 08bb5f39..4053a8e1 100644 --- a/.github/workflows/test.presets.yml +++ b/.github/workflows/test.presets.yml @@ -1,11 +1,13 @@ -name: Test +name: Test (presets) on: pull_request: branches: [ presets ] workflow_call: inputs: - HEAD_REF: + ref: + type: string + repo: type: string jobs: @@ -27,4 +29,5 @@ jobs: - name: Run tests run: npm run test-presets env: - HEAD_REF: ${{ inputs.HEAD_REF }} \ No newline at end of file + HEAD_REF: ${{ inputs.ref }} + REPO: ${{ inputs.repo }} \ No newline at end of file