From 6b89bcb4ac18225a2bb3e38ff371fbf106575d70 Mon Sep 17 00:00:00 2001 From: Martin Nikov Date: Fri, 20 Dec 2024 18:01:10 +0200 Subject: [PATCH] feat(github): Add reusable Lint job --- .github/workflows/reusable-lint-job.yml | 48 +++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/reusable-lint-job.yml diff --git a/.github/workflows/reusable-lint-job.yml b/.github/workflows/reusable-lint-job.yml new file mode 100644 index 00000000..1ce155ef --- /dev/null +++ b/.github/workflows/reusable-lint-job.yml @@ -0,0 +1,48 @@ +name: "Lint" + +on: + # Allow this workflow to be reused by other workflows: + workflow_call: + inputs: + runner: + description: 'JSON-encoded list of runner labels' + default: '["self-hosted"]' + required: false + type: string + + secrets: + NIX_GITHUB_TOKEN: + description: GitHub token to add as access-token in nix.conf + required: false + CACHIX_AUTH_TOKEN: + description: 'Cachix auth token' + required: true + +jobs: + lint: + runs-on: self-hosted + steps: + - uses: actions/checkout@v4 + + - name: Install Nix + uses: metacraft-labs/nixos-modules/.github/install-nix@main + with: + nix-github-token: ${{ secrets.NIX_GITHUB_TOKEN }} + cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }} + cachix-cache: ${{ vars.CACHIX_CACHE }} + trusted-public-keys: ${{ vars.TRUSTED_PUBLIC_KEYS }} + substituters: ${{ vars.SUBSTITUTERS }} + + - uses: cachix/cachix-action@v15 + with: + name: ${{ vars.CACHIX_CACHE }} + authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} + + - name: Build & activate the Nix Dev Shell + run: | + eval "$(nix print-dev-env --accept-flake-config --accept-flake-config --impure .#devShells.x86_64-linux.default || echo exit 1)" + env >> "$GITHUB_ENV" + + - name: Check formatting + run: pre-commit run --all +