Skip to content

[TEST]

[TEST] #217

Workflow file for this run

# ⚠️ DO NOT EDIT THIS FILE, IT IS GENERATED BY COPIER ⚠️
# Changes here will be lost on a future update.
# See: https://github.com/ingadhoc/addons-repo-template
name: pre-commit
on:
push:
branches: "[0-9][0-9].0"
pull_request_target:
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
-
name: Checkout
if: github.event_name != 'pull_request_target'
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.ref }}
-
name: Checkout
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
-
id: setup-python
name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
-
name: Pre-commit cache
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ steps.setup-python.outputs.python-version }}|${{ hashFiles('.pre-commit-config.yaml') }}
-
id: precommit
name: Pre-commit
uses: pre-commit/action@v3.0.1
continue-on-error: true
-
name: Create commit status
if: github.event_name == 'pull_request_target'
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }} \
-d '{"state":"${{ steps.precommit.outcome }}","context":"pre-commit","target_url": "${{ github.event.pull_request.html_url }}"}' \
--fail
-
name: Set output if pre-commit failed
if: steps.precommit.outcome == 'failure'
run: |
exit 1