Merge branch 'main' into co/code #2
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: Check formatting flow | ||
on: | ||
workflow_call: | ||
inputs: | ||
python-version: | ||
description: "Python version to use" | ||
default: "3.9" | ||
required: false | ||
type: string | ||
github_token: | ||
description: "if provided an user GH's token, it will push update; requires `push` event" | ||
default: "" | ||
required: false | ||
type: string | ||
use_cache: | ||
description: "enable using GH caching for performance boost" | ||
default: true | ||
required: false | ||
type: boolean | ||
defaults: | ||
run: | ||
shell: bash | ||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
submodules: recursive | ||
- name: Set up Python 🐍 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
- name: Cache 💽 pre-commit | ||
if: inputs.use_cache == true | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pre-commit | ||
key: pre-commit|${{ hashFiles('.pre-commit-config.yaml') }} | ||
- name: Run pre-commit 🤖 | ||
id: precommit | ||
run: | | ||
pip install -q pre-commit | ||
pre-commit run --all-files | ||
- name: Fixing Pull Request ↩️ | ||
if: always() && inputs.github_token != '' && steps.precommit.outcome == 'failure' | ||
uses: actions-js/[email protected] | ||
with: | ||
github_token: ${{ inputs.github_token }} | ||
message: "pre-commit: running and fixing..." | ||
branch: ${{ github.ref_name }} |