Refactor stream to use framegrab #46
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 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
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: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install Ruff | |
run: pip install ruff | |
- name: Run Ruff format | |
run: ruff format src/ | |
- name: Run Ruff lint with fixes | |
run: ruff check --fix src/ --exit-zero | |
- name: Check if any files were modified | |
id: git-check | |
run: echo "modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT | |
- name: Push changes if needed | |
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 commit -am "Automatically reformatting code with ruff" | |
git push |