diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index 0d62ccc..fb8bc94 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -5,6 +5,12 @@ on: branches: - master +permissions: + contents: read + packages: write + attestations: write + id-token: write + jobs: changes: runs-on: ubuntu-latest @@ -22,6 +28,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 +61,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..3eee6bf --- /dev/null +++ b/.github/workflows/reusable-pre-commit.yml @@ -0,0 +1,28 @@ +name: Reusable Pre-commit + +on: + workflow_call: + inputs: + base_sha: + required: true + type: string + head_sha: + required: true + type: string + +permissions: + contents: read + +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 @@