From d3fa0dcb96772d7690b027d5b23cf73dd8296094 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Fri, 8 Nov 2024 21:50:55 -0500 Subject: [PATCH 1/2] build: add pre-commit checks for yaml + shellscript --- .pre-commit-config.yaml | 10 ++++++++++ bootstrap.sh | 3 +++ 2 files changed, 13 insertions(+) create mode 100644 .pre-commit-config.yaml create mode 100755 bootstrap.sh diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..36fd866 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,10 @@ +--- +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: check-yaml + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.10.0.1 + hooks: + - id: shellcheck diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 0000000..e90b121 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +pipx run pre-commit install -- 2.45.2 From 014ce605da0a331d3f44aba11f93acc378899c87 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Fri, 8 Nov 2024 21:51:13 -0500 Subject: [PATCH 2/2] ci: run pre-commit hook on ci --- .forgejo/workflows/push.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .forgejo/workflows/push.yml diff --git a/.forgejo/workflows/push.yml b/.forgejo/workflows/push.yml new file mode 100644 index 0000000..51734b8 --- /dev/null +++ b/.forgejo/workflows/push.yml @@ -0,0 +1,12 @@ +name: Push +on: [push] + +jobs: + static-analysis: + runs-on: runner-latest + steps: + - uses: actions/checkout@v4 + - name: Validate Yaml + run: pipx run pre-commit run check-yaml -a + - name: Validate shell scripts + run: pipx run pre-commit run shellcheck -a -- 2.45.2