fix uploading vm images using virtctl (#422) #33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pre-Commit Checks | |
on: [push, pull_request] | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install pre-commit | |
run: pip install pre-commit | |
- name: Run pre-commit hooks | |
run: | | |
git fetch origin main || git fetch origin master | |
base_commit=$(git rev-parse --verify origin/main || git rev-parse --verify origin/master || echo "") | |
if [ -z "$base_commit" ]; then | |
files=$(git ls-files '*.yaml' '*.md') | |
else | |
files=$(git diff --name-only "$base_commit" -- '*.yaml' '*.md') | |
fi | |
if [ -n "$files" ]; then | |
echo "$files" | xargs pre-commit run --files | |
else | |
echo "No YAML or Markdown files to lint" | |
fi |