From 44f17f8392f9eed8103783ba712ed8635ffcdf2d Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Sat, 27 Jul 2024 14:08:22 +0200 Subject: [PATCH 1/2] workflows/check-nix-format: Fix reporting of renamed files When a file was renamed, it would previously report the old path as being unformatted. This fixes it to report the new one instead. --- .github/workflows/check-nix-format.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-nix-format.yml b/.github/workflows/check-nix-format.yml index a3ffc40cc37b..bd1d54091c23 100644 --- a/.github/workflows/check-nix-format.yml +++ b/.github/workflows/check-nix-format.yml @@ -76,7 +76,7 @@ jobs: if [[ -n "$source" ]] && ! nixfmt --check ${{ env.base }}/"$source" 2>/dev/null; then echo "Ignoring file $file because it's not formatted in the base commit" elif ! nixfmt --check "$dest"; then - unformattedFiles+=("$file") + unformattedFiles+=("$dest") fi done < <(git diff -z --name-status ${{ env.baseRev }} -- '*.nix') From a1c36999b803bfa3e1268cedc7c0a72340c5c48c Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Sat, 27 Jul 2024 14:14:12 +0200 Subject: [PATCH 2/2] workflows/check-nix-format: Allow testing in forks It seems like imposed limitation came from ofborg not running in forks, which doesn't apply for standard GitHub actions: 88c60d97fc10feef054b2f06e73d2f97de712952 --- .github/workflows/check-nix-format.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-nix-format.yml b/.github/workflows/check-nix-format.yml index bd1d54091c23..eed685946c3b 100644 --- a/.github/workflows/check-nix-format.yml +++ b/.github/workflows/check-nix-format.yml @@ -15,7 +15,7 @@ permissions: jobs: nixos: runs-on: ubuntu-latest - if: "github.repository_owner == 'NixOS' && !contains(github.event.pull_request.title, '[skip treewide]')" + if: "!contains(github.event.pull_request.title, '[skip treewide]')" steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: