From 7e77c06a9d9b38050d37ea888f5b139a7325ab92 Mon Sep 17 00:00:00 2001 From: ZoopaMario Date: Sun, 29 Dec 2024 04:04:38 +0100 Subject: [PATCH] Add workflows verifying bash and commit messages This PR adds the first two workflows: 1. Bash linter 2. Commit message verification --- .forgejo/workflows/check-commit-message.yml | 30 ++++++++++++++++++++ .forgejo/workflows/lint-bash.yml | 31 +++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 .forgejo/workflows/check-commit-message.yml create mode 100644 .forgejo/workflows/lint-bash.yml diff --git a/.forgejo/workflows/check-commit-message.yml b/.forgejo/workflows/check-commit-message.yml new file mode 100644 index 0000000..647adae --- /dev/null +++ b/.forgejo/workflows/check-commit-message.yml @@ -0,0 +1,30 @@ +name: Check Commit Messages + +on: + push: + paths-ignore: + - '**/*.sh' # Commit messages are checked regardless of file type + pull_request: + paths-ignore: + - '**/*.sh' + +jobs: + check-commit-message: + runs-on: docker + container: + image: node:16-bullseye # Node.js pre-installed, based on Debian + + steps: + - name: Checkout Code + uses: https://code.forgejo.org/actions/checkout@v4 + with: + fetch-depth: 0 # Fetch the entire history to avoid REST API reliance + + - name: Check Commit Messages + run: | + echo "Checking commit message format..." + if ! git log -1 --pretty=%B | grep -Eq '^(feat|fix|chore|docs|style|refactor|test|perf):'; then + echo "Commit message does not follow the conventional format: : " + exit 1 + fi + diff --git a/.forgejo/workflows/lint-bash.yml b/.forgejo/workflows/lint-bash.yml new file mode 100644 index 0000000..2798744 --- /dev/null +++ b/.forgejo/workflows/lint-bash.yml @@ -0,0 +1,31 @@ +name: Lint Bash Scripts + +on: + push: + paths: + - '**/*.sh' + pull_request: + paths: + - '**/*.sh' + +jobs: + lint-bash: + runs-on: docker + container: + image: node:16-bullseye # Node.js pre-installed, based on Debian + + steps: + - name: Checkout Code + uses: https://code.forgejo.org/actions/checkout@v4 + with: + fetch-depth: 0 # Fetch the entire history to avoid REST API reliance + + - name: Install ShellCheck + run: | + apt-get update && apt-get install -y shellcheck + + - name: Lint Bash Scripts + run: | + echo "Linting Bash scripts..." + find . -name '*.sh' -print0 | xargs -0 shellcheck +