diff --git a/.github/actions/base/commit-check/action.yml b/.github/actions/base/commit-check/action.yml index c0f5a92..4afd00f 100644 --- a/.github/actions/base/commit-check/action.yml +++ b/.github/actions/base/commit-check/action.yml @@ -10,19 +10,6 @@ inputs: runs: using: composite steps: - - name: Install commitlint CLI - if: github.event_name == 'pull_request' - shell: bash - working-directory: ${{ env.HOLDEX_WORKING_DIR || '.' }} - run: | - if [ "${{ inputs.package-manager }}" = "pnpm" ]; then - pnpm add -g @commitlint/cli - elif [ "${{ inputs.package-manager }}" = "npm" ]; then - npm install -g @commitlint/cli - else - bun i -g @commitlint/cli - fi - - name: Check for commitlint config id: commitlint-config if: github.event_name == 'pull_request' @@ -69,8 +56,18 @@ runs: env: PR_TITLE: ${{ github.event.pull_request.title }} run: | + run_commitlint() { + if [ "${{ inputs.package-manager }}" = "pnpm" ]; then + pnpm dlx @commitlint/cli "$@" + elif [ "${{ inputs.package-manager }}" = "npm" ]; then + npx --yes @commitlint/cli "$@" + else + bunx @commitlint/cli "$@" + fi + } + if [ "${{ steps.commitlint-config.outputs.has-config }}" = "true" ]; then - echo "$PR_TITLE" | commitlint + echo "$PR_TITLE" | run_commitlint else - echo "$PR_TITLE" | commitlint --default-config + echo "$PR_TITLE" | run_commitlint --default-config fi diff --git a/.github/actions/base/markdown-check/action.yml b/.github/actions/base/markdown-check/action.yml index 8fdfcb9..3c431c7 100644 --- a/.github/actions/base/markdown-check/action.yml +++ b/.github/actions/base/markdown-check/action.yml @@ -85,19 +85,6 @@ runs: bun i --frozen-lockfile fi - - name: Install rumdl (fallback) - if: steps.resolved-markdown-files.outputs.any-changed == 'true' && steps.rumdl-deps.outputs.has-rumdl != 'true' - shell: bash - working-directory: ${{ env.HOLDEX_WORKING_DIR || '.' }} - run: | - if [ "${{ inputs.package-manager }}" = "pnpm" ]; then - pnpm add -g rumdl - elif [ "${{ inputs.package-manager }}" = "npm" ]; then - npm install -g rumdl - else - bun i -g rumdl - fi - - name: Skip when no markdown files changed if: steps.resolved-markdown-files.outputs.any-changed != 'true' shell: bash @@ -112,11 +99,12 @@ runs: run_rumdl() { if [ -x "./node_modules/.bin/rumdl" ]; then ./node_modules/.bin/rumdl "$@" - elif command -v rumdl >/dev/null 2>&1; then - rumdl "$@" + elif [ "${{ inputs.package-manager }}" = "pnpm" ]; then + pnpm dlx rumdl "$@" + elif [ "${{ inputs.package-manager }}" = "npm" ]; then + npx --yes rumdl "$@" else - echo "::error::rumdl not found locally or globally." >&2 - exit 1 + bunx rumdl "$@" fi } diff --git a/.github/actions/base/prettier/action.yml b/.github/actions/base/prettier/action.yml index 67efce8..7991d39 100644 --- a/.github/actions/base/prettier/action.yml +++ b/.github/actions/base/prettier/action.yml @@ -60,24 +60,6 @@ runs: echo "No package.json found, skipping dependency installation." fi - - name: Install Prettier (fallback) - if: steps.resolved-files.outputs.any-changed == 'true' - shell: bash - working-directory: ${{ env.HOLDEX_WORKING_DIR || '.' }} - run: | - if [ -x "./node_modules/.bin/prettier" ]; then - echo "Using project-local Prettier." - exit 0 - fi - - if [ "${{ inputs.package-manager }}" = "pnpm" ]; then - pnpm add -g prettier - elif [ "${{ inputs.package-manager }}" = "npm" ]; then - npm install -g prettier - else - bun i -g prettier - fi - - name: Check for Prettier config id: prettier-config if: steps.resolved-files.outputs.any-changed == 'true' @@ -87,11 +69,12 @@ runs: run_prettier() { if [ -x "./node_modules/.bin/prettier" ]; then ./node_modules/.bin/prettier "$@" - elif command -v prettier >/dev/null 2>&1; then - prettier "$@" + elif [ "${{ inputs.package-manager }}" = "pnpm" ]; then + pnpm dlx prettier "$@" + elif [ "${{ inputs.package-manager }}" = "npm" ]; then + npx --yes prettier "$@" else - echo "::error::Prettier not found locally or globally." >&2 - exit 1 + bunx prettier "$@" fi } @@ -126,11 +109,12 @@ runs: run_prettier() { if [ -x "./node_modules/.bin/prettier" ]; then ./node_modules/.bin/prettier "$@" - elif command -v prettier >/dev/null 2>&1; then - prettier "$@" + elif [ "${{ inputs.package-manager }}" = "pnpm" ]; then + pnpm dlx prettier "$@" + elif [ "${{ inputs.package-manager }}" = "npm" ]; then + npx --yes prettier "$@" else - echo "::error::Prettier not found locally or globally." >&2 - exit 1 + bunx prettier "$@" fi } diff --git a/ACTIONS.md b/ACTIONS.md index d28d0c2..25dfafe 100644 --- a/ACTIONS.md +++ b/ACTIONS.md @@ -61,7 +61,7 @@ Path: `/.github/actions/base/prettier` - Runs dependency install in repo context when `package.json` exists: - `bun i --frozen-lockfile`, `pnpm install --frozen-lockfile`, or `npm ci`. - Uses project-local Prettier (`./node_modules/.bin/prettier`) when available after dependency install. -- Installs Prettier globally as a fallback only when no local binary is found. +- Falls back to `pnpm dlx` / `npx` / `bunx prettier` when no local binary is found. - Verifies a resolvable Prettier config exists. - Runs `prettier --check --ignore-unknown` on changed files. - Respects `HOLDEX_WORKING_DIR` env var: all steps run in that directory when set. @@ -81,8 +81,8 @@ Path: `/.github/actions/base/markdown-check` - Filters/uses markdown-only changed files. - Skips execution if no markdown files changed. - If `rumdl` is declared in `package.json`, installs project dependencies with frozen lockfile. -- Otherwise installs `rumdl` globally using selected package manager. -- Uses project-local `rumdl` (`./node_modules/.bin/rumdl`) when available, otherwise global. +- Uses project-local `rumdl` (`./node_modules/.bin/rumdl`) when available. +- Otherwise falls back to `pnpm dlx` / `npx` / `bunx rumdl`. - Runs `rumdl check --output-format github --fail-on error` on changed markdown files. - Respects `HOLDEX_WORKING_DIR` env var: all steps run in that directory when set. @@ -97,12 +97,12 @@ Path: `/.github/actions/base/commit-check` #### Behavior - Runs only on `pull_request` events for install/config/check steps. -- Installs commitlint CLI globally using selected package manager. - Detects commitlint configuration from standard config files or `package.json`. - If config exists, installs dependencies in repo context: - `bun i --frozen-lockfile`, `pnpm install --frozen-lockfile`, or `npm ci`. -- If config does not exist, validates using `commitlint --default-config`. -- Validates PR title via `commitlint`. +- Runs `@commitlint/cli` via `pnpm dlx` / `npx` / `bunx` (no global install). +- If config does not exist, validates using `--default-config`. +- Validates PR title via commitlint. - Respects `HOLDEX_WORKING_DIR` env var: all steps run in that directory when set. ## Composed Actions