Skip to content

mantulen/pre-commit-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

pre-commit action with PR comments 🚀

pre-commit Super-Linter CI Check dist/ CodeQL Coverage codecov

This action runs pre-commit against your code, creates a job summary, and adds a comment on your pull request with the results of the run.

Screenshot

image

Settings

Inputs

All inputs are optional.

Key Name Required Example Default Value Description
base-url No https://my.github-enterprise-server.com/api/v3 https://api.github.com An optional GitHub REST API URL to connect to a different GitHub instance
github-token No gho_****** ${{ github.token }} The GitHub token used to create an authenticated client
issue-number No 101 ${{ github.event.number }} ID of the issue or pull request to comment on. Default is the number of the pull request that triggered the action
skip-comment No true false Whether to skip commenting on the pull request. true or false
skip-job-summary No true false Whether to skip adding result to the job summary. true or false
debug No true ${{ runner.debug == '1' }} Whether to tell the GitHub client to log details of its requests. true or false. Default is to run in debug mode when the GitHub Actions step debug logging is turned on
python-path No /usr/local/python/current/bin/python python Custom path to Python executable
pre-commit-path No /home/vscode/.local/bin/pre-commit pre-commit Custom path to pre-commit executable

Outputs

Key Name Description
result Pre-commit result in JSON format, if you need to use the output in a later step

Example workflow YAML

Place in /.github/workflows/pre-commit-check.yml

on:
    pull_request:
        branches:
            - main
    push:
        branches:
            - main

permissions:
    contents: read
    pull-requests: write

jobs:
    ci-checks:
        name: Run continuous integration checks
        runs-on: ubuntu-latest

        steps:
            - name: Checkout
              uses: actions/checkout@v4

            - name: Run pre-commit checks
              id: run-pre-commit
              uses: mantulen/[email protected]

            - name: Print Output
              id: output
              run: echo "${{ steps.run-pre-commit.outputs.result }}"

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published