Skip to content

Commit

Permalink
feat(github): Add reusable Lint job
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinNikov authored and PetarKirov committed Dec 27, 2024
1 parent 7359062 commit 4158a73
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Lint

on:
# Run this workflow when PRs target `main` and when they're merged in `main`:
pull_request:
branches:
- main

jobs:
lint:
uses: ./.github/workflows/reusable-lint.yml
secrets: inherit
with:
runner: '["self-hosted", "Linux", "x86-64-v2"]'
37 changes: 37 additions & 0 deletions .github/workflows/reusable-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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 }}

- name: Check formatting
run: nix develop --accept-flake-config .#pre-commit -c pre-commit run --all --show-diff-on-failure --color=always

0 comments on commit 4158a73

Please sign in to comment.