Skip to content

Commit

Permalink
ci(pre-commit): Format YAML files automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
Holzhaus committed Nov 3, 2024
1 parent 9c12ba4 commit ca69cc2
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 105 deletions.
17 changes: 9 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
---
version: 2
updates:
# Check for updated Rust packages
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: cargo
directory: /
schedule:
interval: weekly
# Check for updated GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
19 changes: 10 additions & 9 deletions .github/workflows/dependabot-auto-merge.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
name: Auto-merge Dependabot PR

on:
pull_request:
pull_request:

jobs:
auto-merge:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ahmadnassri/action-dependabot-auto-merge@v2
with:
target: major
github-token: ${{ secrets.mytoken }}
auto-merge:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ahmadnassri/action-dependabot-auto-merge@v2
with:
target: major
github-token: ${{ secrets.mytoken }}
61 changes: 31 additions & 30 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,41 @@
---
name: pre-commit

on:
push:
pull_request:
push:
pull_request:

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Generate Cargo.lock
uses: actions-rs/cargo@v1
with:
command: generate-lockfile
- name: Generate Cargo.lock
uses: actions-rs/cargo@v1
with:
command: generate-lockfile

- name: Set up Python
uses: actions/setup-python@v5
- name: Set up Python
uses: actions/setup-python@v5

- name: Detect code style issues
uses: pre-commit/[email protected]
env:
SKIP: no-commit-to-branch
- name: Detect code style issues
uses: pre-commit/[email protected]
env:
SKIP: no-commit-to-branch

- name: Generate patch file
if: failure()
run: |
git diff-index -p HEAD > "${PATCH_FILE}"
[ -s "${PATCH_FILE}" ] && echo "UPLOAD_PATCH_FILE=${PATCH_FILE}" >> "${GITHUB_ENV}"
env:
PATCH_FILE: pre-commit.patch
- name: Generate patch file
if: failure()
run: |
git diff-index -p HEAD > "${PATCH_FILE}"
[ -s "${PATCH_FILE}" ] && echo "UPLOAD_PATCH_FILE=${PATCH_FILE}" >> "${GITHUB_ENV}"
env:
PATCH_FILE: pre-commit.patch

- name: Upload patch artifact
if: failure() && env.UPLOAD_PATCH_FILE != null
uses: actions/upload-artifact@v4
with:
name: ${{ env.UPLOAD_PATCH_FILE }}
path: ${{ env.UPLOAD_PATCH_FILE }}
- name: Upload patch artifact
if: failure() && env.UPLOAD_PATCH_FILE != null
uses: actions/upload-artifact@v4
with:
name: ${{ env.UPLOAD_PATCH_FILE }}
path: ${{ env.UPLOAD_PATCH_FILE }}
108 changes: 50 additions & 58 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,62 +1,54 @@
---
default_language_version:
python: python3
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-case-conflict
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-xml
- id: check-yaml
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: forbid-new-submodules
- id: mixed-line-ending
- id: trailing-whitespace
exclude: ".tsv$"
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
args: [
--ignore-words=.codespellignore
]
exclude_types: [tsv, json]
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
hooks:
- id: fmt
args: [
--all,
--,
]
- id: clippy
args: [
--locked,
--workspace,
--all-features,
--all-targets,
--,
-D,
warnings,
]
- repo: https://github.com/Holzhaus/sourceheaders
rev: v0.0.4
hooks:
- id: sourceheaders
- repo: https://github.com/jorisroovers/gitlint
rev: v0.19.1
hooks:
- id: gitlint
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-case-conflict
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-xml
- id: check-yaml
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: forbid-new-submodules
- id: mixed-line-ending
- id: trailing-whitespace
exclude: .tsv$
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
args: [--ignore-words=.codespellignore]
exclude_types: [tsv, json]
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.2.1
hooks:
- id: yamlfmt
- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
hooks:
- id: fmt
args: [--all, --]
- id: clippy
args: [--locked, --workspace, --all-features, --all-targets, --, -D, warnings]
- repo: https://github.com/Holzhaus/sourceheaders
rev: v0.0.4
hooks:
- id: sourceheaders
- repo: https://github.com/jorisroovers/gitlint
rev: v0.19.1
hooks:
- id: gitlint

ci:
skip: [fmt, clippy]
skip: [fmt, clippy]

0 comments on commit ca69cc2

Please sign in to comment.