Skip to content

feat: support Windows runner#219

Open
shenxianpeng wants to merge 5 commits into
mainfrom
feature/support-windows-runner
Open

feat: support Windows runner#219
shenxianpeng wants to merge 5 commits into
mainfrom
feature/support-windows-runner

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Jun 18, 2026

Copy link
Copy Markdown
Member

Summary

Make this GitHub Action compatible with Windows runners (windows-latest). The core logic (main.py) is already cross-platform — the only blockers were in the composite action's shell run block.

Changes

action.yml

Before, all paths and commands were hardcoded for Linux/macOS:

Item Linux/macOS (before) Windows (broken)
Python command python3 python3 not available
venv activation source venv/bin/activate ❌ should be venv/Scripts/activate
run main.py python3 ... ❌ should use python

After this PR, platform-specific variables are set early:

if [[ "$RUNNER_OS" == "Windows" ]]; then
  PYTHON_CMD="python"
  VENV_ACTIVATE="venv/Scripts/activate"
else
  # Linux/macOS — unchanged behavior, DEB_PYTHON_INSTALL_LAYOUT still Linux-only
  PYTHON_CMD="python3"
  VENV_ACTIVATE="venv/bin/activate"
fi

All subsequent commands use $PYTHON_CMD and source "$VENV_ACTIVATE".

Compatibility

  • ubuntu-latest — identical behavior (just indirect via variables now)
  • macos-latest — identical behavior
  • windows-latest — newly supported
  • ⚠️ No changes to main.py — it already uses cross-platform stdlib APIs
  • ⚠️ commit-check and PyGithub are both pure-Python wheels (py3-none-any), so no platform-specific wheel issues

Testing

Could you run the action on a Windows runner before merging to confirm? Something like:

commit-check:
  strategy:
    matrix:
      os: [ubuntu-latest, windows-latest]
  runs-on: ${{ matrix.os }}
  # ... rest of workflow

Summary by CodeRabbit

  • Improvements
    • Enhanced cross-platform compatibility with OS-aware command execution for Windows and Linux environments.
    • Increased maximum commit message subject length from 80 to 100 characters for more descriptive commit messages.

…d and venv activate path

- Use  variable (python on Windows, python3 on Linux/macOS)
- Use  for correct venv activation path
  (venv/Scripts/activate on Windows, venv/bin/activate on Linux/macOS)
- Keep DEB_PYTHON_INSTALL_LAYOUT Linux-specific

The action now works on all three GitHub-hosted runner OSes:
ubuntu-latest, macos-latest, and windows-latest.
@shenxianpeng shenxianpeng requested a review from a team as a code owner June 18, 2026 17:22
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Commit-Check ✔️

Increase maximum subject length for commit messages.
@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@shenxianpeng, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 16 minutes and 47 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8ca2af32-4885-4959-8a01-4368bdd20e2e

📥 Commits

Reviewing files that changed from the base of the PR and between cb06023 and d352cb8.

📒 Files selected for processing (2)
  • .github/workflows/commit-check.yml
  • main.py
📝 Walkthrough

Walkthrough

action.yml is updated to detect RUNNER_OS and select the appropriate Python executable (PYTHON_CMD) and virtualenv activation path for Windows versus Linux, replacing hardcoded python3 references throughout the venv setup and main.py execution. commit-check.toml increases subject_max_length from 80 to 100.

Changes

Cross-platform action script and config update

Layer / File(s) Summary
OS-aware Python venv setup and execution
action.yml
Adds a platform detection block that sets PYTHON_CMD and the venv activation command based on RUNNER_OS (Windows vs. Linux), applies a Debian install layout tweak on Linux only, and replaces hardcoded python3 with $PYTHON_CMD for dependency installation and main.py execution.
Commit subject max length increase
commit-check.toml
subject_max_length in the [commit] section is raised from 80 to 100.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested labels

enhancement

🐰 Hop, hop, hooray!
Windows or Linux, I don't mind,
$PYTHON_CMD leads the way,
And subject lines now stretch to ninety-nine—
Wait, one hundred! How divine! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: support Windows runner' is directly related to the main change: adding Windows runner support by making the composite action OS-aware with platform-specific Python command and virtualenv activation logic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/support-windows-runner

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Run the self-test workflow on both ubuntu-latest and windows-latest
to validate Windows compatibility. PR comments are only posted from
the ubuntu job to avoid duplicates.
…lity

On Windows, Python's default encoding is cp1252, which doesn't support
Unicode characters like the ❌ emoji used in result messages. This caused
UnicodeEncodeError when:
1. Reading GitHub event JSON files with UTF-8 content (get_pr_title, is_fork_pr, get_pr_number)
2. Writing job summary with emoji characters (add_job_summary)
3. Reading/writing result.txt with potential Unicode content

Fixed all 7 open() calls to explicitly use encoding='utf-8'.
When text=True, subprocess.run uses the system default encoding (cp1252
on Windows) to encode stdin input. If commit messages contain Unicode
characters outside cp1252 (e.g. ❌), the encoding fails with
UnicodeEncodeError.

The other two subprocess.run calls already had encoding='utf-8'.
@shenxianpeng shenxianpeng added the enhancement New feature or request label Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant