Skip to content

Generate references for actions and workflows #17

Generate references for actions and workflows

Generate references for actions and workflows #17

name: Pre-Commit Check
on:
pull_request:
jobs:
pre-commit-check:
runs-on: ubuntu-latest
steps:
# - name: Check if Pre-Commit Ran Locally
# run: |
# if [ -f .git/COMMIT_EDITMSG ]; then
# echo "Pre-Commit were not run locally. Please run 'pre-commit run --all-files' locally before committing."
# exit 1
# else
# echo "Pre-Commit were run locally. Proceeding with the workflow."
# fi
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pre-commit
- name: Check if pre-commit ran locally
run: |
# if git rev-parse --verify ${{ github.ref }} >/dev/null 2>&1; then
if git rev-parse --verify HEAD >/dev/null 2>&1; then
echo "Checking if pre-commit ran locally..."
if [ -f .pre_commit_ran ]; then
echo "Pre-commit checks were run locally."
else
echo "Pre-commit checks were not run locally. Please run 'pre-commit run --all-files' before pushing."
exit 1
fi
else
echo "This is not a push to a branch. Skipping pre-commit check."
fi