mirror of
https://github.com/saltstack-formulas/template-formula.git
synced 2025-04-17 10:10:28 +00:00
Merge pull request #1 from dafyddj/ci/pre-commit
ci: run `pre-commit` in GitHub Actions
This commit is contained in:
commit
84ac6a5b6c
1 changed files with 45 additions and 0 deletions
45
.github/workflows/main.yml
vendored
Normal file
45
.github/workflows/main.yml
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
name: Test & release
|
||||
|
||||
'on':
|
||||
- pull_request
|
||||
- push
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
# yamllint disable-line rule:line-length
|
||||
cancel-in-progress: ${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }}
|
||||
|
||||
jobs:
|
||||
should-run:
|
||||
name: Should run
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
outputs:
|
||||
should-run: ${{ steps.action.outputs.should-run }}
|
||||
steps:
|
||||
- id: action
|
||||
uses:
|
||||
# yamllint disable-line rule:comments rule:line-length
|
||||
techneg-it/should-workflow-run@dcbb88600d59ec2842778ef1e2d41f680f876329 # v1.0.0
|
||||
pre-commit:
|
||||
name: Run `pre-commit`
|
||||
needs: should-run
|
||||
if: fromJSON(needs.should-run.outputs.should-run)
|
||||
container: techneg/ci-pre-commit:v2.2.29
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# yamllint disable-line rule:comments rule:line-length
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Export Python package hash for caching
|
||||
run: echo "PYTHON_SHA256=$PYTHON_SHA256" >> $GITHUB_ENV
|
||||
# yamllint disable-line rule:comments rule:line-length
|
||||
- uses: actions/cache@v4.1.2
|
||||
with:
|
||||
path: ~/.cache/pre-commit
|
||||
key: "pre-commit-4|${{ env.PYTHON_SHA256 }}|\
|
||||
${{ hashFiles('.pre-commit-config.yaml') }}"
|
||||
- name: Run `pre-commit`
|
||||
run: |
|
||||
git config --global --add safe.directory $(pwd)
|
||||
pre-commit run --all-files --color always --verbose
|
Loading…
Add table
Reference in a new issue