Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add an input flag to configure diff output in code style checks #599

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions code-style/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ inputs:
default: true
type: boolean

show-diff-on-failure:
description: |
Whether to show the diff when a pre-commit hook fails.
required: false
default: true
type: boolean

runs:
using: "composite"
steps:
Expand Down Expand Up @@ -164,7 +171,7 @@ runs:
python -m venv .venv
env:
PIPX_BIN_DIR: ${{ runner.temp }}/pipx/bin
PIPX_HOME : ${{ runner.temp }}/pipx/home
PIPX_HOME: ${{ runner.temp }}/pipx/home

- name: "Create a virtual environment"
if: env.BUILD_BACKEND == 'pip'
Expand Down Expand Up @@ -203,7 +210,11 @@ runs:
shell: bash
run: |
source .venv/bin/activate
pre-commit run --all-files --show-diff-on-failure
if [[ ${{ inputs.show-diff-on-failure }} == 'true' ]]; then
pre-commit run --all-files --show-diff-on-failure
else
pre-commit run --all-files
fi

# ------------------------------------------------------------------------

Expand Down