Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/build-frontends.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ permissions:
contents: read

jobs:
# Skip push builds for branches whose open PR already builds them; see pr-build-gate.yml.
gate:
permissions:
pull-requests: read
uses: ./.github/workflows/pr-build-gate.yml

build:
needs: gate
if: needs.gate.outputs.run == 'true'
runs-on: ubuntu-latest

steps:
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/build-ilspy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,16 @@ env:
StagingDirectory: buildartifacts

jobs:
# Skip push builds for branches whose open PR already builds them; see pr-build-gate.yml.
Gate:
permissions:
pull-requests: read
uses: ./.github/workflows/pr-build-gate.yml

Build:
name: Desktop (Windows)
needs: Gate
if: needs.Gate.outputs.run == 'true'
permissions:
packages: write # for dotnet nuget push
runs-on: windows-2025-vs2026
Expand Down Expand Up @@ -283,6 +291,8 @@ jobs:
# [Platform("Win")]. ILSpy.Tests.Windows runs only in the Windows job by design.

Desktop:
needs: Gate
if: needs.Gate.outputs.run == 'true'
strategy:
fail-fast: false
matrix:
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/pr-build-gate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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"
Loading