mirror of https://github.com/icsharpcode/ILSpy.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.1 KiB
32 lines
1.1 KiB
name: PR build gate |
|
|
|
on: |
|
workflow_call: |
|
outputs: |
|
run: |
|
description: Whether the push-triggered build should run |
|
value: ${{ jobs.gate.outputs.run }} |
|
|
|
jobs: |
|
# Skip push builds for branches whose open PR (base master/release/*) already builds |
|
# them via the pull_request trigger. Pushes to master/release/* always build (they |
|
# may publish packages, and no PR of theirs may suppress that). |
|
gate: |
|
runs-on: ubuntu-latest |
|
permissions: |
|
pull-requests: read |
|
outputs: |
|
run: ${{ steps.check.outputs.run }} |
|
steps: |
|
- id: check |
|
env: |
|
GH_TOKEN: ${{ github.token }} |
|
run: | |
|
prs=0 |
|
case "$GITHUB_EVENT_NAME/$GITHUB_REF_NAME" in |
|
push/master|push/release/*) ;; |
|
push/*) prs=$(gh api -X GET "repos/$GITHUB_REPOSITORY/pulls" -f state=open \ |
|
-f head="$GITHUB_REPOSITORY_OWNER:$GITHUB_REF_NAME" \ |
|
--jq 'map(select(.base.ref == "master" or (.base.ref | startswith("release/")))) | length') ;; |
|
esac |
|
echo "run=$([ "$prs" = 0 ] && echo true || echo false)" >> "$GITHUB_OUTPUT"
|
|
|