Skip to content
This repository was archived by the owner on Jun 11, 2026. It is now read-only.

INF-1484/feat: extract inline shell to Python modules + add pytest#21

Merged
brtkwr merged 1 commit into
mainfrom
INF-1484/feat/extract-shell-to-python-modules
Jun 3, 2026
Merged

INF-1484/feat: extract inline shell to Python modules + add pytest#21
brtkwr merged 1 commit into
mainfrom
INF-1484/feat/extract-shell-to-python-modules

Conversation

@brtkwr

@brtkwr brtkwr commented Jun 3, 2026

Copy link
Copy Markdown
Member

Summary

  • Extracts the four inline shell/JS blocks in action.yaml into a testable Python package (pre_commit_action/)
  • Replaces the 55-line github-script@v9 JavaScript block with a Python equivalent, removing the actions/github-script dependency entirely
  • Adds 19 pytest unit tests covering PM detection, node install dispatch, pre-commit exit code propagation, comment rendering, and middle-truncation boundary conditions
  • Adds .github/workflows/ci.yaml running pytest on every PR and push to main
  • Extends dependabot.yml with the pip ecosystem

Acceptance criteria

Criterion Status
Bash/JS logic is in Python modules, testable in isolation Done
19 pytest unit tests pass Verified locally (19/19)
CI workflow runs pytest Added in .github/workflows/ci.yaml

Scope check

Stayed within INF-1484 scope. No version bumps, no refactors outside the four step blocks.

Verification

pip install -e .[dev]
pytest
# 19 passed in 0.05s

Full CI run will complete in GitHub Actions after merge.

Fixes INF-1484

https://claude.ai/code/session_014J66yccpjXZMWNfXH87B4J

Replaces the four inline shell/JS blocks in action.yaml with testable
Python modules under pre_commit_action/:

- detect_pm.py     -- lockfile-based package manager detection
- install_node_deps.py -- pnpm/yarn/npm install dispatch
- run_hooks.py     -- uvx pre-commit subprocess wrapper
- render_comment.py -- middle-truncation + markdown comment render
  (replaces the github-script@v9 JS block entirely)

The action gains an "Install action scripts" step that pip-installs the
package from ${{ github.action_path }}, then each former shell/JS block
becomes a one-liner: `python -m pre_commit_action.<module>`.

Adds 19 pytest unit tests covering: PM detection priority, yarn
modern vs classic, npm install, pre-commit exit code propagation,
render success/failure comment content, missing output file, and
middle-truncation boundary conditions.

Adds .github/workflows/ci.yaml (pytest on PR + push to main) and
extends dependabot.yml with the pip ecosystem.

Refs INF-1484

https://claude.ai/code/session_014J66yccpjXZMWNfXH87B4J
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@brtkwr brtkwr merged commit 121bc11 into main Jun 3, 2026
1 check passed
@brtkwr brtkwr deleted the INF-1484/feat/extract-shell-to-python-modules branch June 3, 2026 06:23
brtkwr added a commit that referenced this pull request Jun 4, 2026
The python-modules refactor (#21) dropped the set +e exit-code capture:
under the composite shell's bash -e, a hook failure aborted the step
before EXIT_CODE was written, continue-on-error masked the step failure,
and the report step ran exit '' which succeeds. Every hook failure since
has reported green. Restore the capture with -e disabled, drop the
now-pointless continue-on-error, and make the report step fail loud if
the exit code is ever missing.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant