From 7450cea426e79baf91701a8b2c692a87ab8fa684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Thu, 3 Oct 2024 21:19:53 +0200 Subject: [PATCH] Improve workflows --- .github/workflows/actions-check.yaml | 33 ++++++++++++++++++++++++++++ .github/workflows/flake-check.yaml | 4 ++-- .github/workflows/flake-update.yaml | 11 +++++----- flake.nix | 8 ++++++- 4 files changed, 47 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/actions-check.yaml diff --git a/.github/workflows/actions-check.yaml b/.github/workflows/actions-check.yaml new file mode 100644 index 0000000..6778768 --- /dev/null +++ b/.github/workflows/actions-check.yaml @@ -0,0 +1,33 @@ +name: Check actions +on: + push: + paths: + - .github/workflows/*.yaml + - .github/workflows/*.yml + pull_request: + paths: + - .github/workflows/*.yaml + - .github/workflows/*.yml + +jobs: + check-actions-actionlint: + runs-on: ubuntu-latest + container: + image: ghcr.io/catthehacker/ubuntu:runner-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v5 + with: + go-version: '1.23' + - run: | + go install github.com/rhysd/actionlint/cmd/actionlint@latest + actionlint .github/workflows/*.yaml + check-actions-yamllint: + runs-on: ubuntu-latest + container: + image: ghcr.io/catthehacker/ubuntu:runner-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v5 + - run: | + pipx run yamllint .github/workflows/*.yaml diff --git a/.github/workflows/flake-check.yaml b/.github/workflows/flake-check.yaml index b74f82d..93c4acb 100644 --- a/.github/workflows/flake-check.yaml +++ b/.github/workflows/flake-check.yaml @@ -1,10 +1,10 @@ -name: flake-check +name: Run nix flake check on: push: pull_request: jobs: - build: + flake-check: runs-on: ubuntu-latest container: image: ghcr.io/catthehacker/ubuntu:runner-latest diff --git a/.github/workflows/flake-update.yaml b/.github/workflows/flake-update.yaml index 4102340..b971cd0 100644 --- a/.github/workflows/flake-update.yaml +++ b/.github/workflows/flake-update.yaml @@ -1,11 +1,11 @@ +--- name: Periodic flake update -on: +on: # yamllint disable-line rule:truthy schedule: - - cron: '0 */2 * * *' - workflow_dispatch: + - cron: "0 */2 * * *" - permissions: - contents: write +permissions: + contents: write jobs: flake-update: @@ -23,4 +23,3 @@ jobs: run: nix flake update --commit-lock-file - name: push run: git push - diff --git a/flake.nix b/flake.nix index 648b0a7..59c20c9 100644 --- a/flake.nix +++ b/flake.nix @@ -132,7 +132,13 @@ devShells = forAllSystems ( { pkgs }: { - default = pkgs.mkShell { packages = with pkgs; [ pre-commit ]; }; + default = pkgs.mkShell { + packages = with pkgs; [ + act + actionlint + yamllint + ]; + }; } ); };