mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
workflows: run on merge conflicts as well
When a PR is having conflicts with the base branch, we used to skip most jobs depending on the target branch. With this change, we still run those jobs, but without actually merging the PR temporarily. That means we compare the head of the PR with the merge-base of the PR's branch and the target branch - i.e. the point where the PR branched off. This is not 100% accurate, but that's not important, because after resolving the merge conflicts, those workflows will run again anyway. It allows to give early feedback, though, instead of just skipping all the jobs.
This commit is contained in:
parent
277f7b998c
commit
c77cfb9239
1 changed files with 12 additions and 1 deletions
13
.github/workflows/get-merge-commit.yml
vendored
13
.github/workflows/get-merge-commit.yml
vendored
|
@ -68,7 +68,18 @@ jobs:
|
|||
|
||||
return { mergedSha, targetSha }
|
||||
} else {
|
||||
throw new Error("The PR has a merge conflict. Skipping the rest...")
|
||||
console.log("The PR has a merge conflict.")
|
||||
|
||||
const mergedSha = prInfo.head.sha
|
||||
const targetSha = (await github.rest.repos.compareCommitsWithBasehead({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
basehead: `${prInfo.base.sha}...${prInfo.head.sha}`
|
||||
})).data.merge_base_commit.sha
|
||||
|
||||
console.log(`Checking the commits:\nmerged:${mergedSha}\ntarget:${targetSha}`)
|
||||
|
||||
return { mergedSha, targetSha }
|
||||
}
|
||||
}
|
||||
throw new Error("Not retrying anymore. It's likely that GitHub is having internal issues: check https://www.githubstatus.com.")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue