Merge pull request #2527 from Ludy87/fix_pre_commit_config_2

Update .pre-commit-config.yaml no. 2
This commit is contained in:
Anthony Stirling 2024-12-21 17:36:13 +00:00 committed by GitHub
commit 46261c55b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 50 additions and 57 deletions

View File

@ -11,7 +11,7 @@ updates:
interval: "weekly" interval: "weekly"
open-pull-requests-limit: 10 open-pull-requests-limit: 10
rebase-strategy: "auto" rebase-strategy: "auto"
- package-ecosystem: "docker" - package-ecosystem: "docker"
directory: "/" # Location of Dockerfile directory: "/" # Location of Dockerfile
schedule: schedule:

4
.github/release.yml vendored
View File

@ -9,7 +9,7 @@ changelog:
- title: Bug Fixes - title: Bug Fixes
labels: labels:
- Bug - Bug
- title: Enhancements - title: Enhancements
labels: labels:
- enhancement - enhancement
@ -26,7 +26,7 @@ changelog:
- title: Translation Changes - title: Translation Changes
labels: labels:
- Translation - Translation
- title: Other Changes - title: Other Changes
labels: labels:
- "*" - "*"

View File

@ -8,14 +8,14 @@ jobs:
check-comment: check-comment:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: | if: |
github.event.issue.pull_request && github.event.issue.pull_request &&
( (
contains(github.event.comment.body, 'prdeploy') || contains(github.event.comment.body, 'prdeploy') ||
contains(github.event.comment.body, 'deploypr') contains(github.event.comment.body, 'deploypr')
) )
&& &&
( (
github.event.comment.user.login == 'frooodle' || github.event.comment.user.login == 'frooodle' ||
github.event.comment.user.login == 'sf298' || github.event.comment.user.login == 'sf298' ||
github.event.comment.user.login == 'Ludy87' || github.event.comment.user.login == 'Ludy87' ||
github.event.comment.user.login == 'LaserKaspar' || github.event.comment.user.login == 'LaserKaspar' ||
@ -49,26 +49,26 @@ jobs:
script: | script: |
const { owner, repo } = context.repo; const { owner, repo } = context.repo;
const prNumber = context.payload.issue.number; const prNumber = context.payload.issue.number;
const { data: pr } = await github.rest.pulls.get({ const { data: pr } = await github.rest.pulls.get({
owner, owner,
repo, repo,
pull_number: prNumber, pull_number: prNumber,
}); });
// For forks, use the full repository name, for internal PRs use the current repo // For forks, use the full repository name, for internal PRs use the current repo
const repository = pr.head.repo.fork ? pr.head.repo.full_name : `${owner}/${repo}`; const repository = pr.head.repo.fork ? pr.head.repo.full_name : `${owner}/${repo}`;
console.log(`PR Repository: ${repository}`); console.log(`PR Repository: ${repository}`);
console.log(`PR Branch: ${pr.head.ref}`); console.log(`PR Branch: ${pr.head.ref}`);
core.setOutput('repository', repository); core.setOutput('repository', repository);
core.setOutput('ref', pr.head.ref); core.setOutput('ref', pr.head.ref);
deploy-pr: deploy-pr:
needs: check-comment needs: check-comment
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Harden Runner - name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
@ -81,7 +81,7 @@ jobs:
repository: ${{ needs.check-comment.outputs.pr_repository }} repository: ${{ needs.check-comment.outputs.pr_repository }}
ref: ${{ needs.check-comment.outputs.pr_ref }} ref: ${{ needs.check-comment.outputs.pr_ref }}
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up JDK - name: Set up JDK
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0 uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
with: with:
@ -156,10 +156,10 @@ jobs:
ssh -i ../private.key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -T ${{ secrets.VPS_USERNAME }}@${{ secrets.VPS_HOST }} << 'ENDSSH' ssh -i ../private.key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -T ${{ secrets.VPS_USERNAME }}@${{ secrets.VPS_HOST }} << 'ENDSSH'
# Create PR-specific directories # Create PR-specific directories
mkdir -p /stirling/PR-${{ needs.check-comment.outputs.pr_number }}/{data,config,logs} mkdir -p /stirling/PR-${{ needs.check-comment.outputs.pr_number }}/{data,config,logs}
# Move docker-compose file to correct location # Move docker-compose file to correct location
mv /tmp/docker-compose.yml /stirling/PR-${{ needs.check-comment.outputs.pr_number }}/docker-compose.yml mv /tmp/docker-compose.yml /stirling/PR-${{ needs.check-comment.outputs.pr_number }}/docker-compose.yml
# Start or restart the container # Start or restart the container
cd /stirling/PR-${{ needs.check-comment.outputs.pr_number }} cd /stirling/PR-${{ needs.check-comment.outputs.pr_number }}
docker-compose pull docker-compose pull

View File

@ -16,7 +16,7 @@ jobs:
cleanup: cleanup:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event.action == 'closed' if: github.event.action == 'closed'
steps: steps:
- name: Harden Runner - name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
@ -35,20 +35,20 @@ jobs:
CLEANUP_STATUS=$(ssh -i ../private.key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -T ${{ secrets.VPS_USERNAME }}@${{ secrets.VPS_HOST }} << 'ENDSSH' CLEANUP_STATUS=$(ssh -i ../private.key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -T ${{ secrets.VPS_USERNAME }}@${{ secrets.VPS_HOST }} << 'ENDSSH'
if [ -d "/stirling/PR-${{ github.event.pull_request.number }}" ]; then if [ -d "/stirling/PR-${{ github.event.pull_request.number }}" ]; then
echo "Found PR directory, proceeding with cleanup..." echo "Found PR directory, proceeding with cleanup..."
# Stop and remove containers # Stop and remove containers
cd /stirling/PR-${{ github.event.pull_request.number }} cd /stirling/PR-${{ github.event.pull_request.number }}
docker-compose down || true docker-compose down || true
# Go back to root before removal # Go back to root before removal
cd / cd /
# Remove PR-specific directories # Remove PR-specific directories
rm -rf /stirling/PR-${{ github.event.pull_request.number }} rm -rf /stirling/PR-${{ github.event.pull_request.number }}
# Remove the Docker image # Remove the Docker image
docker rmi --no-prune ${{ secrets.DOCKER_HUB_USERNAME }}/test:pr-${{ github.event.pull_request.number }} || true docker rmi --no-prune ${{ secrets.DOCKER_HUB_USERNAME }}/test:pr-${{ github.event.pull_request.number }} || true
echo "PERFORMED_CLEANUP" echo "PERFORMED_CLEANUP"
else else
echo "PR directory not found, nothing to clean up" echo "PR directory not found, nothing to clean up"
@ -56,7 +56,7 @@ jobs:
fi fi
ENDSSH ENDSSH
) )
if [[ $CLEANUP_STATUS == *"PERFORMED_CLEANUP"* ]]; then if [[ $CLEANUP_STATUS == *"PERFORMED_CLEANUP"* ]]; then
echo "cleanup_performed=true" >> $GITHUB_OUTPUT echo "cleanup_performed=true" >> $GITHUB_OUTPUT
else else

View File

@ -26,4 +26,4 @@ jobs:
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
yaml-file: .github/labels.yml yaml-file: .github/labels.yml
skip-delete: true skip-delete: true

View File

@ -22,7 +22,7 @@ jobs:
# platform: linux # platform: linux
# ext: deb # ext: deb
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Harden Runner - name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
@ -47,7 +47,7 @@ jobs:
run: | run: |
curl -L -o wix.exe https://github.com/wixtoolset/wix3/releases/download/wix3141rtm/wix314.exe curl -L -o wix.exe https://github.com/wixtoolset/wix3/releases/download/wix3141rtm/wix314.exe
.\wix.exe /install /quiet .\wix.exe /install /quiet
# Install Linux dependencies # Install Linux dependencies
- name: Install Linux Dependencies - name: Install Linux Dependencies
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
@ -89,7 +89,7 @@ jobs:
# Upload installer as artifact for testing # Upload installer as artifact for testing
- name: Upload Installer Artifact - name: Upload Installer Artifact
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with: with:
name: Stirling-PDF-${{ matrix.platform }}-installer.${{ matrix.ext }} name: Stirling-PDF-${{ matrix.platform }}-installer.${{ matrix.ext }}
path: Stirling-PDF-${{ matrix.platform }}-installer.${{ matrix.ext }} path: Stirling-PDF-${{ matrix.platform }}-installer.${{ matrix.ext }}
retention-days: 1 retention-days: 1

View File

@ -57,7 +57,7 @@ jobs:
overwrite: true overwrite: true
retention-days: 1 retention-days: 1
if-no-files-found: error if-no-files-found: error
- name: Upload binaries to release - name: Upload binaries to release
uses: softprops/action-gh-release@7b4da11513bf3f43f9999e90eabced41ab8bb048 # v2.2.0 uses: softprops/action-gh-release@7b4da11513bf3f43f9999e90eabced41ab8bb048 # v2.2.0
with: with:

View File

@ -1,6 +1,6 @@
repos: repos:
- repo: https://github.com/astral-sh/ruff-pre-commit - repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.1 rev: v0.8.4
hooks: hooks:
- id: ruff - id: ruff
args: args:
@ -12,7 +12,7 @@ repos:
files: ^((.github/scripts|scripts)/.+)?[^/]+\.py$ files: ^((.github/scripts|scripts)/.+)?[^/]+\.py$
exclude: (split_photos.py) exclude: (split_photos.py)
- repo: https://github.com/codespell-project/codespell - repo: https://github.com/codespell-project/codespell
rev: v2.2.6 rev: v2.3.0
hooks: hooks:
- id: codespell - id: codespell
args: args:
@ -21,6 +21,25 @@ repos:
- --quiet-level=2 - --quiet-level=2
files: \.(properties|html|css|js|py|md)$ files: \.(properties|html|css|js|py|md)$
exclude: (.vscode|.devcontainer|src/main/resources|Dockerfile) exclude: (.vscode|.devcontainer|src/main/resources|Dockerfile)
- repo: https://github.com/gitleaks/gitleaks
rev: v8.22.0
hooks:
- id: gitleaks
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0
hooks:
- id: shellcheck
files: ^.*(\.bash|\.sh|\.ksh|\.zsh)$
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: end-of-file-fixer
files: ^.*(\.js|\.java|\.py|\.yml)$
exclude: ^(.*/pdfjs.*|.*/thirdParty.*|bootstrap.*|.*\.min\..*|.*diff\.js$)
- id: trailing-whitespace
files: ^.*(\.js|\.java|\.py|\.yml)$
exclude: ^(.*/pdfjs.*|.*/thirdParty.*|bootstrap.*|.*\.min\..*|.*diff\.js$)
- repo: local - repo: local
hooks: hooks:
- id: check-duplicate-properties-keys - id: check-duplicate-properties-keys
@ -28,37 +47,11 @@ repos:
entry: python .github/scripts/check_duplicates.py entry: python .github/scripts/check_duplicates.py
language: python language: python
files: ^(src)/.+\.properties$ files: ^(src)/.+\.properties$
- repo: local
hooks:
- id: check-html-tabs - id: check-html-tabs
name: Check HTML for tabs name: Check HTML for tabs
description: Ensures HTML/CSS/JS files do not contain tab characters
# args: ["--replace_with= "] # args: ["--replace_with= "]
entry: python .github/scripts/check_tabulator.py entry: python .github/scripts/check_tabulator.py
language: python language: python
exclude: ^(src/main/resources/static/pdfjs|src/main/resources/static/pdfjs-legacy) exclude: ^(.*/pdfjs.*|.*/thirdParty.*|bootstrap.*|.*\.min\..*|.*diff\.js$)
files: ^.*(\.html|\.css|\.js)$ files: ^.*(\.html|\.css|\.js)$
# - repo: https://github.com/gherynos/pre-commit-java
# rev: v0.2.4
# hooks:
# - id: Checkstyle
- repo: https://github.com/gitleaks/gitleaks
rev: v8.16.3
hooks:
- id: gitleaks
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0
hooks:
- id: shellcheck
# - repo: https://github.com/pre-commit/mirrors-eslint
# rev: v8.38.0
# hooks:
# - id: eslint
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
# - repo: https://github.com/pylint-dev/pylint
# rev: v2.17.2
# hooks:
# - id: pylint