Skip to content

Commit 8cc2bcf

Browse files
committed
fix(gha): pre-commit action
1 parent c0414db commit 8cc2bcf

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

.github/workflows/pre-commit.yml

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ jobs:
2020
- name: Checkout
2121
uses: actions/checkout@v4
2222

23-
- name: GitHub Context
24-
env:
25-
GITHUB_CONTEXT: ${{ toJson(github) }}
26-
run: echo "$GITHUB_CONTEXT"
27-
2823
- name: Set up uv
2924
uses: astral-sh/setup-uv@v6
3025
with:
@@ -48,37 +43,37 @@ jobs:
4843
continue-on-error: true
4944
run: uv run pre-commit run -a
5045

51-
- name: Verify latest commit message format
52-
id: commitizen
53-
if: ${{ github.event_name == 'pull_request' }}
54-
continue-on-error: true
55-
run: |
56-
echo "Latest commit message: $(git show -s --format=%s)"
57-
uv run cz check --message "$(git show -s --format=%s)"
58-
5946
- name: Share pre-commit guidance
60-
if: ${{ github.event_name == 'pull_request' && (steps.precommit.outcome == 'failure' || steps.commitizen.outcome == 'failure') }}
47+
if: ${{ github.event_name == 'pull_request' && (steps.precommit.outcome == 'failure') }}
6148
uses: marocchino/sticky-pull-request-comment@v2
6249
with:
6350
message: |
6451
### ⚠️ Pre-commit Checks Failed
6552
6653
${{ steps.precommit.outcome == 'failure' && '- Run `uv run pre-commit run -a` locally to reproduce the issues.' || '' }}
67-
${{ steps.commitizen.outcome == 'failure' && '- Ensure your latest commit message follows the Commitizen format (e.g. `feat: add awesome thing`).' || '' }}
68-
${{ steps.commitizen.outcome == 'failure' && ' Validate it locally with `uv run cz check --message "<type>: <description>"`.' || '' }}
6954
70-
Fix the issues locally with:
55+
To reproduce the issues locally, run the following commands:
7156
7257
```bash
7358
git clone ${{ github.event.pull_request.head.repo.clone_url }}
7459
git checkout -b ${{ github.event.pull_request.head.ref }}
7560
uv run pre-commit run -a
7661
```
7762
78-
See the [`uv` documentation for installation instructions](https://docs.astral.sh/uv/getting-started/installation/)
63+
To always run pre-commit checks locally before pushing changes, simple run the following command once:
64+
65+
```bash
66+
uv run pre-commit install
67+
```
68+
69+
#### Resources
70+
- [Documentation to install `uv`](https://docs.astral.sh/uv/getting-started/installation/)
71+
- [Conventional Commits](https://www.conventionalcommits.org/) standards for writing commit messages
72+
- [Commitizen](https://commitizen-tools.github.io/commitizen/) CLI tool for writing commit messages
73+
- [pre-commit](https://pre-commit.com/) CLI tool for running pre-commit hooks
7974
8075
- name: Celebrate spotless PR
81-
if: ${{ github.event_name == 'pull_request' && steps.precommit.outcome == 'success' && steps.commitizen.outcome == 'success' }}
76+
if: ${{ github.event_name == 'pull_request' && steps.precommit.outcome == 'success' }}
8277
uses: marocchino/sticky-pull-request-comment@v2
8378
with:
8479
message: |
@@ -87,5 +82,5 @@ jobs:
8782
Thanks for keeping the repo tidy! ✨
8883
8984
- name: Fail if checks failed
90-
if: ${{ steps.precommit.outcome == 'failure' || steps.commitizen.outcome == 'failure' }}
85+
if: ${{ steps.precommit.outcome == 'failure' }}
9186
run: exit 1

0 commit comments

Comments
 (0)