edge-inference on k3s on balena! #457
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: auto-format | |
on: pull_request | |
env: | |
POETRY_VERSION: "1.5.1" | |
PYTHON_VERSION: "3.11" | |
jobs: | |
format: | |
# Check if the PR is not from a fork | |
if: github.event.pull_request.head.repo.full_name == github.repository | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get Code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install Poetry | |
uses: snok/[email protected] | |
with: | |
version: ${{ env.POETRY_VERSION }} | |
- name: Install Linting Dependencies | |
run: | | |
make install-lint | |
- name: Run Formatter | |
run: | | |
make format | |
- name: Check for Modified Files | |
id: git-check | |
run: | | |
git status | |
echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi) | |
- name: Push Changes | |
if: steps.git-check.outputs.modified == 'true' | |
run: | | |
git config --global user.name 'Auto-format Bot' | |
git config --global user.email '[email protected]' | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | |
git commit -am "Automatically reformatting code with black and isort" | |
git push |