Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 20, 2026

Summary

This PR sets up a matrix strategy in the GitHub Actions workflow to test hook installation using both scripts/install-hooks.py and scripts/install-hooks.sh.

Changes

.github/workflows/test-hooks.yml

  • Added install-method to the matrix with values ['install-hooks.py', 'install-hooks.sh']
  • Updated job name to include the installation method
  • Added INSTALL_HOOKS_METHOD environment variable to the test step
  • Added explicit permissions block (contents: read) for security
  • Excluded Windows + install-hooks.sh combination from matrix
  • This creates 5 test jobs:
    • Ubuntu: install-hooks.py, install-hooks.sh
    • macOS: install-hooks.py, install-hooks.sh
    • Windows: install-hooks.py only

scripts/install-hooks.py

  • Added automatic script directory detection using os.path.dirname(os.path.abspath(__file__))
  • Updated hook file reading to use absolute paths from the script directory
  • Now works like install-hooks.sh - can be run from any directory
  • Fixed typo: "occured" -> "occurred"
  • Does NOT set executable permissions (delegated to post-installation in tests)

test_hooks.py

  • Modified _install_hooks() to read the INSTALL_HOOKS_METHOD environment variable
  • Added logic to install hooks using either install-hooks.py or install-hooks.sh
  • Set install-hooks.py as the default installation method
  • Removed _manual_install_hooks() fallback method
  • Improved error handling: raises errors for unknown installation methods or missing bash on Windows
  • Added post-installation chmod for install-hooks.py to set executable permissions on Unix
  • Added proper Windows bash detection for install-hooks.sh

Testing

All tests pass with both installation methods on Linux:

  • install-hooks.py (default)
  • install-hooks.sh

The matrix ensures both scripts are tested on Ubuntu and macOS, while Windows only tests install-hooks.py.

Original prompt

Set up matrix in the tests to install hooks using either scripts/install-hooks.py or scripts/install-hooks.sh.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 8 commits January 20, 2026 16:25
Co-authored-by: doitian <35768+doitian@users.noreply.github.com>
…rror handling

Co-authored-by: doitian <35768+doitian@users.noreply.github.com>
Co-authored-by: doitian <35768+doitian@users.noreply.github.com>
Co-authored-by: doitian <35768+doitian@users.noreply.github.com>
Co-authored-by: doitian <35768+doitian@users.noreply.github.com>
Co-authored-by: doitian <35768+doitian@users.noreply.github.com>
…oks.py

Co-authored-by: doitian <35768+doitian@users.noreply.github.com>
Co-authored-by: doitian <35768+doitian@users.noreply.github.com>
Copilot AI changed the title [WIP] Set up matrix to install hooks using scripts Add matrix testing for both hook installation methods Jan 20, 2026
Copilot AI requested a review from doitian January 20, 2026 16:40
@doitian doitian marked this pull request as ready for review January 20, 2026 16:41
@doitian
Copy link
Owner

doitian commented Jan 20, 2026

@copilot Do not test install-hooks.sh in Windows.

Co-authored-by: doitian <35768+doitian@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 20, 2026

@copilot Do not test install-hooks.sh in Windows.

Excluded Windows + install-hooks.sh from the test matrix. The workflow now runs 5 jobs instead of 6. (4bb1258)

@doitian doitian merged commit fcc3cb5 into master Jan 20, 2026
5 checks passed
@doitian doitian deleted the copilot/setup-matrix-install-hooks branch January 20, 2026 16:47
Copilot stopped work on behalf of doitian due to an error January 20, 2026 16:47
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.

2 participants