name: flake check

on:
  pull_request:
  push:

permissions: read-all

jobs:
  tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      # Install `nix` which is just a dead-simple way to get a stable `poetry`
      # in scope.
      - uses: cachix/install-nix-action@v20
        with:
          github_access_token: ${{ secrets.GITHUB_TOKEN }}
      # Check that poetry.lock is in sync with pyproject.toml
      - run: nix run github:NixOS/nixpkgs/22.11#poetry -- lock --check
