mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 05:43:50 +03:00
workflows/check-by-name: Better error for merge conflicts
This commit is contained in:
parent
c1a36c3baa
commit
004da0cf91
14
.github/workflows/check-by-name.yml
vendored
14
.github/workflows/check-by-name.yml
vendored
@ -17,16 +17,24 @@ jobs:
|
|||||||
# as specified in nixos/release-combined.nix
|
# as specified in nixos/release-combined.nix
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
- name: Resolving the merge commit
|
||||||
|
run: |
|
||||||
|
if result=$(git ls-remote --exit-code ${{ github.event.pull_request.base.repo.clone_url }} refs/pull/${{ github.event.pull_request.number }}/merge); then
|
||||||
|
mergedSha=$(cut -f1 <<< "$result")
|
||||||
|
echo "The PR appears to not have any conflicts, checking the merge commit $mergedSha"
|
||||||
|
else
|
||||||
|
echo "The PR may have a merge conflict"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "mergedSha=$mergedSha" >> "$GITHUB_ENV"
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
# pull_request_target checks out the base branch by default
|
# pull_request_target checks out the base branch by default
|
||||||
ref: refs/pull/${{ github.event.pull_request.number }}/merge
|
ref: ${{ env.mergedSha }}
|
||||||
# Fetches the merge commit and its parents
|
# Fetches the merge commit and its parents
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
- name: Determining PR git hashes
|
- name: Determining PR git hashes
|
||||||
run: |
|
run: |
|
||||||
echo "mergedSha=$(git rev-parse HEAD)" >> "$GITHUB_ENV"
|
|
||||||
|
|
||||||
# For pull_request_target this is the same as $GITHUB_SHA
|
# For pull_request_target this is the same as $GITHUB_SHA
|
||||||
echo "baseSha=$(git rev-parse HEAD^1)" >> "$GITHUB_ENV"
|
echo "baseSha=$(git rev-parse HEAD^1)" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user