From 4ecfb6b15f739a160180c69862e975dae08bc6d8 Mon Sep 17 00:00:00 2001 From: Stanislas Daniel Claude Dolcini Date: Sun, 25 Aug 2024 11:45:36 +0200 Subject: [PATCH] Add precommit hook --- .gitea/workflows/jobs.yml | 20 ++++++++++---------- .gitea/workflows/pre-commit.yml | 12 ++++++++++++ .pre-commit-config.yaml | 18 ++++++++++++++++++ .yamllint | 7 +++++++ license_gpl-2.0.txt | 0 scripts/copy_files.py | 0 scripts/entvalidate.py | 0 7 files changed, 47 insertions(+), 10 deletions(-) create mode 100644 .gitea/workflows/pre-commit.yml create mode 100644 .pre-commit-config.yaml create mode 100644 .yamllint mode change 100755 => 100644 license_gpl-2.0.txt mode change 100755 => 100644 scripts/copy_files.py mode change 100644 => 100755 scripts/entvalidate.py diff --git a/.gitea/workflows/jobs.yml b/.gitea/workflows/jobs.yml index 0109697..e01ad1c 100644 --- a/.gitea/workflows/jobs.yml +++ b/.gitea/workflows/jobs.yml @@ -60,24 +60,24 @@ jobs: rm minisign-0.11-linux.tar.gz minisign -v - name: Set env secrets - run: | - echo "MODIO_API_KEY=${{ secrets.MODIO_API_KEY }}" >> $GITHUB_ENV - echo "MODIO_OAUTH2_TOKEN=${{ secrets.MODIO_OAUTH2_TOKEN }}" >> $GITHUB_ENV + run: | + echo "MODIO_API_KEY=${{ secrets.MODIO_API_KEY }}" >> $GITHUB_ENV + echo "MODIO_OAUTH2_TOKEN=${{ secrets.MODIO_OAUTH2_TOKEN }}" >> $GITHUB_ENV echo "MOD_VERSION=$(python3 -m scripts.get_version)" >> $GITHUB_ENV echo "${{ secrets.MINISIGN_KEY }}" > signature-file.pem - name: Check Version Increment run: | git fetch --tags if git tag -l | grep -q "^${{ env.VERSION }}$"; then - echo "Tag ${{ env.VERSION }} already exists" - exit 1 + echo "Tag ${{ env.VERSION }} already exists" + exit 1 fi - - uses: https://gitea.wildfiregames.com/Stan/gitea-action-build-pyromod@main + - uses: https://gitea.wildfiregames.com/Stan/gitea-action-build-pyromod@main with: - name: ${{ env.MOD_NAME }} - version: ${{ env.MOD_VERSION }} + name: ${{ env.MOD_NAME }} + version: ${{ env.MOD_VERSION }} - name: Create sha256sum - run: | + run: | OUTPUT_FILE="${{ env.MOD_NAME }}-${{ env.MOD_VERSION }}.pyromod" cd output sha256sum $OUTPUT_FILE > $OUTPUT_FILE.sha256sum @@ -85,7 +85,7 @@ jobs: cp -v $OUTPUT_FILE.sha256sum ../ cp -v ${{ env.MOD_NAME }}-${{ env.MOD_VERSION }}.pyromod ../${{ env.MOD_NAME }}-${{ env.MOD_VERSION }}.zip - name: Sign - run: | + run: | echo ${{ secrets.MINISIGN_KEY_PW }} | minisign -S -s signature-file.pem -m "${{ env.MOD_NAME }}-${{ env.MOD_VERSION }}.zip" -x signature.minisign - name: Upload to Modio run: | diff --git a/.gitea/workflows/pre-commit.yml b/.gitea/workflows/pre-commit.yml new file mode 100644 index 0000000..0237934 --- /dev/null +++ b/.gitea/workflows/pre-commit.yml @@ -0,0 +1,12 @@ +--- +name: pre-commit +on: + - push + - pull_request +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - uses: pre-commit/action@v3.0.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..fbee7c9 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,18 @@ +--- +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-json + - id: check-merge-conflict + - id: check-shebang-scripts-are-executable + - id: check-xml + - id: check-yaml + - repo: https://github.com/adrienverge/yamllint + rev: v1.35.1 + hooks: + - id: yamllint + args: + - -s diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..9dec2df --- /dev/null +++ b/.yamllint @@ -0,0 +1,7 @@ +--- +extends: default + +rules: + truthy: disable + line-length: + max: 160 diff --git a/license_gpl-2.0.txt b/license_gpl-2.0.txt old mode 100755 new mode 100644 diff --git a/scripts/copy_files.py b/scripts/copy_files.py old mode 100755 new mode 100644 diff --git a/scripts/entvalidate.py b/scripts/entvalidate.py old mode 100644 new mode 100755