From 38cb036a038ec85087698d8f2807f768b6f6b965 Mon Sep 17 00:00:00 2001 From: Adi <6841988+DeepSpace2@users.noreply.github.com> Date: Tue, 7 Jul 2026 21:15:43 +0300 Subject: [PATCH 1/3] chore: add pre-commit --- .github/workflows/pr-build.yml | 10 +++++++++ .github/workflows/reusable-docker-build.yml | 2 +- .github/workflows/reusable-pre-commit.yml | 25 +++++++++++++++++++++ .pre-commit-config.yaml | 11 +++++++++ Dockerfile | 1 - README.md | 4 ++-- docs/assets/logo_full.svg | 8 +++---- docs/assets/logo_full_dark.svg | 6 ++--- docs/assets/logo_full_light.svg | 6 ++--- docs/assets/logo_icon.svg | 6 ++--- docs/css/theme.css | 1 - docs/index.md | 4 ++-- docs/js/anchor-jump-highlight.js | 2 +- docs/js/copy-to-clipboard.js | 14 ++++++------ docs/monitoring.md | 5 ++--- docs/theme/overrides/main.html | 2 +- 16 files changed, 75 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/reusable-pre-commit.yml create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index 0d62ccc..3e6d65e 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -22,6 +22,8 @@ jobs: - '.github/workflows/pr-build.yml' - '.github/workflows/release.yml' - '.github/workflows/reusable-docker-build.yml' + - '.github/workflows/reusable-pre-commit.yml' + - '.pre-commit-config.yaml' - 'pkg/**' - 'main.go' - 'go.*' @@ -53,3 +55,11 @@ jobs: needs: changes if: ${{ needs.changes.outputs.src == 'true' }} uses: ./.github/workflows/reusable-unittests.yml + + pre-commit: + needs: changes + if: ${{ needs.changes.outputs.src == 'true' }} + uses: ./.github/workflows/reusable-pre-commit.yml + with: + base_sha: ${{ github.event.pull_request.base.sha }} + head_sha: ${{ github.event.pull_request.head.sha }} diff --git a/.github/workflows/reusable-docker-build.yml b/.github/workflows/reusable-docker-build.yml index e6eaaac..6dc73f0 100644 --- a/.github/workflows/reusable-docker-build.yml +++ b/.github/workflows/reusable-docker-build.yml @@ -18,7 +18,7 @@ jobs: packages: write attestations: write id-token: write - + steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/.github/workflows/reusable-pre-commit.yml b/.github/workflows/reusable-pre-commit.yml new file mode 100644 index 0000000..7b45313 --- /dev/null +++ b/.github/workflows/reusable-pre-commit.yml @@ -0,0 +1,25 @@ +name: Reusable Pre-commit + +on: + workflow_call: + inputs: + base_sha: + required: true + type: string + head_sha: + required: true + type: string + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - uses: pre-commit/action@v3.0.1 + with: + extra_args: --from-ref ${{ inputs.base_sha }} --to-ref ${{ inputs.head_sha }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..dfb250d --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,11 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + + - repo: https://github.com/golangci/golangci-lint + rev: v2.12.2 + hooks: + - id: golangci-lint diff --git a/Dockerfile b/Dockerfile index ef81d9c..93d8097 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,4 +23,3 @@ WORKDIR /app COPY --from=builder /app/plugnpin . CMD [ "./plugnpin" ] - diff --git a/README.md b/README.md index 4af840e..3bf4ebf 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,8 @@ as local DNS/CNAME records in **Pi-Hole** (or DNS Rewrites in **AdGuard Home**) PlugNPiN discovers services by scanning for Docker containers that have the following labels: - `plugNPiN.ip` - The IP address and port of the container (e.g., `192.168.1.100:8080`). -- `plugNPiN.url` - The desired URL for the service (e.g., `my-service.local`). - Multiple domains are supported and should be comma-separated, +- `plugNPiN.url` - The desired URL for the service (e.g., `my-service.local`). + Multiple domains are supported and should be comma-separated, for example `domain1.local,domain2.local`. The application operates in two complementary modes to keep your services synchronized: diff --git a/docs/assets/logo_full.svg b/docs/assets/logo_full.svg index 3dd3d16..0916fd4 100644 --- a/docs/assets/logo_full.svg +++ b/docs/assets/logo_full.svg @@ -6,7 +6,7 @@