From b64d5e1c0c6e2af9ddfc323866b7195d47a01256 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sun, 5 Jan 2025 16:19:08 +0100 Subject: [PATCH] workflows: make checks work with non-NixOS repos No need for that limitation, which only artifically limits test-ability of CI in forks. Some other workflows like backports, cherry-pick checks and periodic merges are very specific to the release branches and don't need to be run in forks. --- .github/workflows/check-maintainers-sorted.yml | 1 - .github/workflows/editorconfig-v2.yml | 4 ++-- .github/workflows/manual-nixos-v2.yml | 2 +- .github/workflows/manual-nixpkgs-v2.yml | 2 +- .github/workflows/nix-parse-v2.yml | 4 ++-- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/check-maintainers-sorted.yml b/.github/workflows/check-maintainers-sorted.yml index e2673059a7af0..266e56fe989ed 100644 --- a/.github/workflows/check-maintainers-sorted.yml +++ b/.github/workflows/check-maintainers-sorted.yml @@ -12,7 +12,6 @@ jobs: nixos: name: maintainer-list-check runs-on: ubuntu-24.04 - if: github.repository_owner == 'NixOS' steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: diff --git a/.github/workflows/editorconfig-v2.yml b/.github/workflows/editorconfig-v2.yml index 90301d84b3757..180fd9fbb2c50 100644 --- a/.github/workflows/editorconfig-v2.yml +++ b/.github/workflows/editorconfig-v2.yml @@ -18,14 +18,14 @@ jobs: name: editorconfig-check runs-on: ubuntu-24.04 needs: get-merge-commit - if: "needs.get-merge-commit.outputs.mergedSha && github.repository_owner == 'NixOS' && !contains(github.event.pull_request.title, '[skip treewide]')" + if: "needs.get-merge-commit.outputs.mergedSha && !contains(github.event.pull_request.title, '[skip treewide]')" steps: - name: Get list of changed files from PR env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | gh api \ - repos/NixOS/nixpkgs/pulls/${{github.event.number}}/files --paginate \ + repos/${{ github.repository }}/pulls/${{ github.event.number }}/files --paginate \ | jq '.[] | select(.status != "removed") | .filename' \ > "$HOME/changed_files" diff --git a/.github/workflows/manual-nixos-v2.yml b/.github/workflows/manual-nixos-v2.yml index 8e6e43af54ca0..e022f27ac693e 100644 --- a/.github/workflows/manual-nixos-v2.yml +++ b/.github/workflows/manual-nixos-v2.yml @@ -14,7 +14,6 @@ jobs: nixos: name: nixos-manual-build runs-on: ubuntu-24.04 - if: github.repository_owner == 'NixOS' steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: @@ -27,6 +26,7 @@ jobs: extra_nix_config: sandbox = true - uses: cachix/cachix-action@ad2ddac53f961de1989924296a1f236fcfbaa4fc # v15 + if: github.repository_owner == 'NixOS' with: # This cache is for the nixpkgs repo checks and should not be trusted or used elsewhere. name: nixpkgs-ci diff --git a/.github/workflows/manual-nixpkgs-v2.yml b/.github/workflows/manual-nixpkgs-v2.yml index 43f883454afe7..cdbafd63054b2 100644 --- a/.github/workflows/manual-nixpkgs-v2.yml +++ b/.github/workflows/manual-nixpkgs-v2.yml @@ -16,7 +16,6 @@ jobs: nixpkgs: name: nixpkgs-manual-build runs-on: ubuntu-24.04 - if: github.repository_owner == 'NixOS' steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: @@ -29,6 +28,7 @@ jobs: extra_nix_config: sandbox = true - uses: cachix/cachix-action@ad2ddac53f961de1989924296a1f236fcfbaa4fc # v15 + if: github.repository_owner == 'NixOS' with: # This cache is for the nixpkgs repo checks and should not be trusted or used elsewhere. name: nixpkgs-ci diff --git a/.github/workflows/nix-parse-v2.yml b/.github/workflows/nix-parse-v2.yml index be4113741d782..f3e5590a9efa4 100644 --- a/.github/workflows/nix-parse-v2.yml +++ b/.github/workflows/nix-parse-v2.yml @@ -18,14 +18,14 @@ jobs: name: nix-files-parseable-check runs-on: ubuntu-24.04 needs: get-merge-commit - if: "needs.get-merge-commit.outputs.mergedSha && github.repository_owner == 'NixOS' && !contains(github.event.pull_request.title, '[skip treewide]')" + if: "needs.get-merge-commit.outputs.mergedSha && !contains(github.event.pull_request.title, '[skip treewide]')" steps: - name: Get list of changed files from PR env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | gh api \ - repos/NixOS/nixpkgs/pulls/${{github.event.number}}/files --paginate \ + repos/${{ github.repository }}/pulls/${{github.event.number}}/files --paginate \ | jq --raw-output '.[] | select(.status != "removed" and (.filename | endswith(".nix"))) | .filename' \ > "$HOME/changed_files" if [[ -s "$HOME/changed_files" ]]; then