(Feat) add YAML and JSON linter on github actions #6
Workflow file for this run
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 | |
on: [push, pull_request] | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10.14' | |
- name: Install pre-commit | |
run: pip install pre-commit | |
- name: Run pre-commit | |
run: | | |
pre-commit run --all-files || { echo "Pre-commit checks failed"; exit 0; } | |
- name: Install GitHub CLI | |
run: | | |
sudo apt-get install gh | |
- name: Commit changes | |
run: | | |
git config --global user.name 'github-actions' | |
git config --global user.email '[email protected]' | |
git add . | |
git diff --cached --quiet || { git commit -m "Apply pre-commit fixes" && gh auth login --with-token <<< $GITHUB_TOKEN && gh repo view --json url --json name | grep url | cut -d':' -f2 | tr -d '"},'; git push; } | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |