nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
fork

Configure Feed

Select the types of activity you want to include in your feed.

workflows/check-by-name: Skip instead of canceling on conflicts

This avoids sending emails when there's merge conflicts.
The check will appear to be green,
but it doesn't matter since the PR can't be merged anyways.

Unfortunately there's no better way to do this right now: https://github.com/actions/runner/issues/662

+8 -13
+8 -13
.github/workflows/check-by-name.yml
··· 16 16 # so it shouldn't be a problem 17 17 types: [opened, synchronize, reopened, edited] 18 18 19 - permissions: 20 - # We need this permission to cancel the workflow run if there's a merge conflict 21 - actions: write 19 + permissions: {} 22 20 23 21 # Create a check-by-name concurrency group based on the pull request number. if 24 22 # an event triggers a run on the same PR while a previous run is still in ··· 77 79 78 80 if [[ "$mergeable" == "true" ]]; then 79 81 echo "The PR can be merged, checking the merge commit $mergedSha" 82 + echo "mergedSha=$mergedSha" >> "$GITHUB_ENV" 80 83 else 81 - echo "The PR cannot be merged, it has a merge conflict, cancelling the workflow.." 82 - gh api \ 83 - --method POST \ 84 - -H "Accept: application/vnd.github+json" \ 85 - -H "X-GitHub-Api-Version: 2022-11-28" \ 86 - /repos/"$GITHUB_REPOSITORY"/actions/runs/"$GITHUB_RUN_ID"/cancel 87 - sleep 60 88 - # If it's still not canceled after a minute, something probably went wrong, just exit 89 - exit 1 84 + echo "The PR cannot be merged, it has a merge conflict, skipping the rest.." 90 85 fi 91 - echo "mergedSha=$mergedSha" >> "$GITHUB_ENV" 92 86 - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 87 + if: env.mergedSha 93 88 with: 94 89 # pull_request_target checks out the base branch by default 95 90 ref: ${{ env.mergedSha }} 96 91 # Fetches the merge commit and its parents 97 92 fetch-depth: 2 98 93 - name: Checking out base branch 94 + if: env.mergedSha 99 95 run: | 100 96 base=$(mktemp -d) 101 97 git worktree add "$base" "$(git rev-parse HEAD^1)" 102 98 echo "base=$base" >> "$GITHUB_ENV" 103 99 - uses: cachix/install-nix-action@8887e596b4ee1134dae06b98d573bd674693f47c # v26 100 + if: env.mergedSha 104 101 - name: Fetching the pinned tool 102 + if: env.mergedSha 105 103 # Update the pinned version using pkgs/test/check-by-name/update-pinned-tool.sh 106 104 run: | 107 105 # The pinned version of the tooling to use ··· 108 114 # Adds a result symlink as a GC root 109 115 nix-store --realise "$toolPath" --add-root result 110 116 - name: Running nixpkgs-check-by-name 117 + if: env.mergedSha 111 118 env: 112 119 # Force terminal colors to be enabled. The library that 113 120 # nixpkgs-check-by-name uses respects: https://bixense.com/clicolors/