Skip to content
/ utils Public

Use pre-commit built-in environment variables#618

Merged
5ouma merged 1 commit intomainfrom
refactor-pre-commit-script-variable
Jan 4, 2026
Merged

Use pre-commit built-in environment variables#618
5ouma merged 1 commit intomainfrom
refactor-pre-commit-script-variable

Conversation

@5ouma
Copy link
Owner

@5ouma 5ouma commented Jan 4, 2026

Prevent trying to get data by itself.

Prevent trying to get data by itself.
Copilot AI review requested due to automatic review settings January 4, 2026 09:46
@github-actions github-actions bot added the 🚸 pre-commit Check the code with pre-commit hooks label Jan 4, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors a pre-commit script to use pre-commit's built-in environment variables (PRE_COMMIT_REMOTE_URL, PRE_COMMIT_FROM_REF, PRE_COMMIT_TO_REF) instead of executing git commands directly to retrieve repository information.

Key changes:

  • Replaces git config --get remote.origin.url with PRE_COMMIT_REMOTE_URL for determining the repository URL
  • Replaces git log --branches --not --remotes with git log "$PRE_COMMIT_FROM_REF".."$PRE_COMMIT_TO_REF" for identifying commits to upload

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coderabbitai
Copy link

coderabbitai bot commented Jan 4, 2026

Caution

Review failed

Failed to post review comments

Walkthrough

The script upload-git-commit-notion is updated to use environment variables (PRE_COMMIT_REMOTE_URL, PRE_COMMIT_FROM_REF, PRE_COMMIT_TO_REF) for URL construction and git log range specification instead of dynamically extracting values from git configuration and branch references.

Changes

Cohort / File(s) Summary
Environment Variable Integration
pre-commit/scripts/upload-git-commit-notion
Replaced dynamic git config extraction with PRE_COMMIT_REMOTE_URL environment variable for URL construction. Changed git log range from branches-based filtering to explicit PRE_COMMIT_FROM_REF..PRE_COMMIT_TO_REF range specification.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: using pre-commit built-in environment variables instead of dynamic extraction.
Description check ✅ Passed The description is related to the changeset as it references using pre-commit built-in environment variables to prevent manual data extraction.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor-pre-commit-script-variable

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.

@5ouma 5ouma merged commit 13f4247 into main Jan 4, 2026
11 checks passed
@5ouma 5ouma deleted the refactor-pre-commit-script-variable branch January 4, 2026 09:49
This was referenced Jan 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🚸 pre-commit Check the code with pre-commit hooks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants