Skip to content

Feature request: Support for pre-commit env variables #548

Description

@tsuoanttila

pre-commit sets some environment variables when you run it with --from-ref foo --to-ref bar that could hopefully be easily picked up and used same as --commits foo..bar. This would make it quite easy to validate every commit in a pre-commit based CI workflow.

For example, when running pre-commit run --from-ref=main --to-ref=HEAD the following env vars are set:

    "PRE_COMMIT_ORIGIN": "main",
    "PRE_COMMIT_SOURCE": "HEAD",
    "PRE_COMMIT_FROM_REF": "main",
    "PRE_COMMIT_TO_REF": "HEAD",
    "PRE_COMMIT": "1",

If you think this is a good idea, but don't have the time, I'll try to make a PR for you Soon™️.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions