Skip to content

feat: prefer yq for YAML, pin js-yaml fallback, drop legacy isEabled#119

Merged
maxisam merged 1 commit into
mainfrom
chore/next-version-config-cleanups
Jun 27, 2026
Merged

feat: prefer yq for YAML, pin js-yaml fallback, drop legacy isEabled#119
maxisam merged 1 commit into
mainfrom
chore/next-version-config-cleanups

Conversation

@maxisam

@maxisam maxisam commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Three small "next-version" cleanups to the composite action's config handling. Branched off main (the composite migration #117 is already merged); independent of the open simplify PR #118.

Changes

  • Prefer yq for YAML config. The loader (scripts/steps/load-config.mjs) now uses an installed yq when it's on PATH (GitHub-hosted runners ship it) via yq -o=json '.' <file>, avoiding an npx download on the common path. It only falls back to npx when yq is absent, exits non-zero, or yields unparseable output. io is threaded into the two steps that load config (resolve-config, jscpd-report); format-report doesn't load config and is unchanged.
  • Pin the js-yaml fallback to js-yaml@4.1.0 (was unpinned npx -y js-yaml), so the on-demand fallback is reproducible — mirroring the existing jscpd@5 pin.
  • Drop the legacy isEabled fallback. isEnabledBlock/resolveEnabled now read only isEnabled. This is a breaking change, intentional for the new composite (major) version — configs must use the correctly-spelled isEnabled. README/WALKTHROUGH call out the removal.

Tests

  • New __tests__/load-config.test.mjs: yq path, pinned-npx fallback, yq-failure → npx fallback, JSON-native (no spawn), missing file → null.
  • Updated the isEnabledBlock test and removed the isEabled backward-compat case.

biome check + 37 node:test pass; action.yml YAML + bash -n clean; the loader was smoke-tested for both the yq and fallback paths.

Note: touches action.yml, scripts/format-args.mjs, and scripts/steps/jscpd-report.mjs, which #118 also touches on different lines — they should merge cleanly in either order, but whichever lands second may want a quick rebase.

https://claude.ai/code/session_01JxEe85CyGm5rCeoLFdUZed

Next-version cleanups to the composite action's config handling:

- YAML loader (steps/load-config.mjs) now prefers an installed `yq` (present on
  GitHub-hosted runners) via `yq -o=json '.' <file>`, and only falls back to a
  one-off, version-pinned `npx -y js-yaml@4.1.0` when yq is absent (or yq exits
  non-zero / yields unexpected output). Avoids the npx download on the common path
  and makes the fallback reproducible.
- Thread github-script's `io` into the two loader steps (resolve-config, jscpd-report)
  so makeLoader can look up `yq`; format-report doesn't load config and is unchanged.
- Drop the legacy misspelled `isEabled` fallback from isEnabledBlock/resolveEnabled.
  This is a breaking change, intentional for the new composite (major) version — use
  `isEnabled`. README/WALKTHROUGH note the removal.
- Tests: add __tests__/load-config.test.mjs (yq path, pinned npx fallback, yq-failure
  fallback, JSON-native, missing file); update isEnabledBlock test and remove the
  isEabled backward-compat case.

biome check + 37 node:test green; action.yml YAML + bash -n clean; loader smoke-tested
for both the yq and fallback paths.

Claude-Session: https://claude.ai/code/session_01JxEe85CyGm5rCeoLFdUZed
@maxisam maxisam merged commit 25727c7 into main Jun 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant