1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-24 22:11:15 +02:00
This commit is contained in:
crertel 2025-06-17 21:50:52 +03:00 committed by GitHub
commit 4bd2bfc522
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -7,7 +7,33 @@ on:
permissions: read-all permissions: read-all
jobs: jobs:
check_merge_conflicts:
runs-on: ubuntu-24.04
steps:
- name: Check for Merge Conflicts
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const prNumber = context.payload.pull_request?.number;
if (!prNumber) {
console.log("Not a pull request, skipping merge conflict check.");
return;
}
const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
});
if (pr.mergeable === false) {
core.setFailed("❌ Merge conflict detected! Please resolve before CI can run.");
} else if (pr.mergeable === null) {
console.setFailed("❌ GitHub is still checking mergeability, rerun if necessary.");
} else {
console.log("✅ No merge conflicts detected.");
}
eval: eval:
needs: check_merge_conflicts
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -17,6 +43,7 @@ jobs:
- run: nix --experimental-features 'nix-command flakes' flake show --all-systems --json - run: nix --experimental-features 'nix-command flakes' flake show --all-systems --json
tests: tests:
needs: check_merge_conflicts
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -53,7 +80,7 @@ jobs:
path: out/* path: out/*
installer_test: installer_test:
needs: [tests] needs: [tests, check_merge_conflicts]
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -96,6 +123,7 @@ jobs:
# 2. Store your dockerhub username as DOCKERHUB_USERNAME in "Repository secrets" of your fork repository settings (https://github.com/$githubuser/nix/settings/secrets/actions) # 2. Store your dockerhub username as DOCKERHUB_USERNAME in "Repository secrets" of your fork repository settings (https://github.com/$githubuser/nix/settings/secrets/actions)
# 3. Create an access token in https://hub.docker.com/settings/security and store it as DOCKERHUB_TOKEN in "Repository secrets" of your fork # 3. Create an access token in https://hub.docker.com/settings/security and store it as DOCKERHUB_TOKEN in "Repository secrets" of your fork
check_secrets: check_secrets:
needs: check_merge_conflicts
permissions: permissions:
contents: none contents: none
name: Check Docker secrets present for installer tests name: Check Docker secrets present for installer tests
@ -111,7 +139,7 @@ jobs:
echo "::set-output name=docker::${{ env._DOCKER_SECRETS != '' }}" echo "::set-output name=docker::${{ env._DOCKER_SECRETS != '' }}"
docker_push_image: docker_push_image:
needs: [tests, vm_tests, check_secrets] needs: [tests, vm_tests, check_secrets, check_merge_conflicts]
permissions: permissions:
contents: read contents: read
packages: write packages: write
@ -170,6 +198,7 @@ jobs:
docker push $IMAGE_ID:master docker push $IMAGE_ID:master
vm_tests: vm_tests:
needs: check_merge_conflicts
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -182,8 +211,8 @@ jobs:
.#hydraJobs.tests.tarballFlakes \ .#hydraJobs.tests.tarballFlakes \
; ;
flake_regressions: flake_regressions:
needs: vm_tests needs: [vm_tests, check_merge_conflicts]
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
steps: steps:
- name: Checkout nix - name: Checkout nix