mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-30 02:37:31 +02:00
ci(common): Fix pre-commit manual run
This commit is contained in:
16
.github/workflows/pre_commit_check.yml
vendored
16
.github/workflows/pre_commit_check.yml
vendored
@ -12,12 +12,15 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
ref: ${{ github.base_ref }}
|
||||||
- name: Fetch head and base refs
|
- name: Fetch head and base refs
|
||||||
# This is necessary for pre-commit to check the changes in the PR branch
|
# This is necessary for pre-commit to check the changes in the PR branch (and to set origin/HEAD and HEAD refs)
|
||||||
run: |
|
run: |
|
||||||
git fetch origin ${{ github.base_ref }}:base_ref
|
git fetch origin ${{ github.event.pull_request.head.sha }}:pr_ref
|
||||||
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr_ref
|
git checkout pr_ref
|
||||||
|
git remote set-head origin --auto
|
||||||
- name: Set up Python environment
|
- name: Set up Python environment
|
||||||
uses: actions/setup-python@master
|
uses: actions/setup-python@master
|
||||||
with:
|
with:
|
||||||
@ -26,13 +29,12 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
pip install pre-commit
|
pip install pre-commit
|
||||||
pre-commit install-hooks
|
pre-commit install-hooks
|
||||||
pre-commit install --hook-type commit-msg --hook-type pre-push
|
|
||||||
- name: Run pre-commit and check for any changes
|
- name: Run pre-commit and check for any changes
|
||||||
run: |
|
run: |
|
||||||
echo "Commits being checked:"
|
echo "Commits being checked:"
|
||||||
git log --oneline --no-decorate base_ref..pr_ref
|
git log --oneline --no-decorate origin/HEAD..HEAD
|
||||||
echo ""
|
echo ""
|
||||||
if ! pre-commit run --from-ref base_ref --to-ref pr_ref --show-diff-on-failure ; then
|
if ! pre-commit run --from-ref origin/HEAD --to-ref HEAD --hook-stage manual --show-diff-on-failure ; then
|
||||||
echo ""
|
echo ""
|
||||||
echo "::notice::It looks like the commits in this PR have been made without having pre-commit hooks installed."
|
echo "::notice::It looks like the commits in this PR have been made without having pre-commit hooks installed."
|
||||||
echo "::notice::Please see https://github.com/espressif/esp-protocols/CONTRIBUTING.md for instructions."
|
echo "::notice::Please see https://github.com/espressif/esp-protocols/CONTRIBUTING.md for instructions."
|
||||||
|
@ -57,7 +57,7 @@ repos:
|
|||||||
hooks:
|
hooks:
|
||||||
- id: commitizen
|
- id: commitizen
|
||||||
- id: commitizen-branch
|
- id: commitizen-branch
|
||||||
stages: [push]
|
stages: [push, manual]
|
||||||
- repo: local
|
- repo: local
|
||||||
hooks:
|
hooks:
|
||||||
- id: commit message scopes
|
- id: commit message scopes
|
||||||
|
Reference in New Issue
Block a user