From 5384aadd7a3e1b1f3b065e6833f63ef98a5f3be1 Mon Sep 17 00:00:00 2001 From: Joseph Nelson Date: Wed, 13 May 2026 23:15:01 -0700 Subject: [PATCH] added a pre-hook to make sure things are linted before commits happen and fixed workflow --- .gitea/hooks/pre-commit | 20 ++++++++++++++++++++ .gitea/workflows/build.yaml | 7 ++++++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100755 .gitea/hooks/pre-commit diff --git a/.gitea/hooks/pre-commit b/.gitea/hooks/pre-commit new file mode 100755 index 0000000..4b6a65f --- /dev/null +++ b/.gitea/hooks/pre-commit @@ -0,0 +1,20 @@ +#!/bin/bash + +# Check if the lint fix command fails +# If it does, exit with a non-zero status to prevent the commit. + +echo "Running lint fix..." +# Replace with your actual lint fix command +# This is just an example, adapt it to your linter and project +npm run lint:fix # e.g., "eslint . --fix" + +# Example: Capture the exit code of the command +lint_fix_result=$? + +if [ $lint_fix_result -ne 0 ]; then + echo "Linting failed. Commit aborted." + exit 1 # Exit with a non-zero status to prevent the commit +fi + +echo "Lint fix completed successfully. Commit allowed." +exit 0 # Exit with a zero status to allow the commit diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 6a96d10..cd24e97 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -1,7 +1,12 @@ name: Build and Push Image -on: [push] +on: + pull_request: + branches: + - main + types: [closed] jobs: build-and-push: + if: gitea.event.pull_request.merged == true runs-on: ubuntu-latest container: image: catthehacker/ubuntu:act-latest