feat: prefer yq for YAML, pin js-yaml fallback, drop legacy isEabled#119
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
yqfor YAML config. The loader (scripts/steps/load-config.mjs) now uses an installedyqwhen it's onPATH(GitHub-hosted runners ship it) viayq -o=json '.' <file>, avoiding annpxdownload on the common path. It only falls back tonpxwhenyqis absent, exits non-zero, or yields unparseable output.iois threaded into the two steps that load config (resolve-config,jscpd-report);format-reportdoesn't load config and is unchanged.js-yamlfallback tojs-yaml@4.1.0(was unpinnednpx -y js-yaml), so the on-demand fallback is reproducible — mirroring the existingjscpd@5pin.isEabledfallback.isEnabledBlock/resolveEnablednow read onlyisEnabled. This is a breaking change, intentional for the new composite (major) version — configs must use the correctly-spelledisEnabled. README/WALKTHROUGH call out the removal.Tests
__tests__/load-config.test.mjs: yq path, pinned-npx fallback, yq-failure → npx fallback, JSON-native (no spawn), missing file → null.isEnabledBlocktest and removed theisEabledbackward-compat case.biome check+ 37node:testpass;action.ymlYAML +bash -nclean; the loader was smoke-tested for both theyqand fallback paths.https://claude.ai/code/session_01JxEe85CyGm5rCeoLFdUZed