Skip to content

fix: Prevent cleanup script from running if cancelled prematurely #81

fix: Prevent cleanup script from running if cancelled prematurely

fix: Prevent cleanup script from running if cancelled prematurely #81

Workflow file for this run

---
name: Pi-Bot CI
# yamllint disable-line rule:truthy
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
env:
# Cache version to control pre-commit caches
CACHE_VERSION: 0
# 3.9 is recent enough
DEFAULT_PYTHON: 3.10.11
# Location of the pre-commit cache. This is set by pre-commit, not us!
PRE_COMMIT_CACHE: ~/.cache/pre-commit
# Cancels previous runs targeting the same hash
concurrency:
group: >
${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4.2.2
- name: Setup Python
uses: actions/setup-python@v5.6.0
with:
python-version: ${{ env.DEFAULT_PYTHON}}
cache: "pip"
- name: Generate pre-commit cache key
id: pre-commit_cache_key
run: >
echo "::set-output
name=key::${{ env.CACHE_VERSION }}-${{ env.DEFAULT_PYTHON }}-${{
hashFiles('.pre-commit-config.yaml') }}"
- name: Install pre-commit
run: |
pip install --upgrade pip
pip install "$(cat requirements_test.txt | grep pre-commit)"
- name: Restore base pre-commit environment
id: cache-pre-commmit
uses: actions/cache@v4.2.0
with:
path: ${{ env.PRE_COMMIT_CACHE }}
key: >
${{ runner.os
}}-pre-commit-${{
steps.pre-commit_cache_key.outputs.key }}
- name: Install pre-commit dependencies if no cache
if: steps.cache-pre-commit.outputs.cache-hit != 'true'
run: |
pre-commit install-hooks
- name: Install hadolint
run: >
sudo wget -O
/bin/hadolint
https://github.com/hadolint/hadolint/releases/download/v2.10.0/hadolint-Linux-x86_64
sudo chmod +x /bin/hadolint
- name: Run hooks
run: >
SKIP=no-commit-to-branch
pre-commit run --all-files --show-diff-on-failure
build:
name: Build Image
needs: lint
if: "github.ref == 'refs/heads/master'"
uses: ./.github/workflows/build.yml