Skip to content

Unify PR build into a single workflow with a dispatcher#18295

Merged
trask merged 1 commit into
open-telemetry:mainfrom
trask:pr-workflow
Apr 29, 2026
Merged

Unify PR build into a single workflow with a dispatcher#18295
trask merged 1 commit into
open-telemetry:mainfrom
trask:pr-workflow

Conversation

@trask

@trask trask commented Apr 25, 2026

Copy link
Copy Markdown
Member

#18235 introduced a new issue where all the old jobs are left as canceled / failed on the PR which is super confusing.

@trask trask added the test native This label can be applied to PRs to trigger them to run native tests label Apr 25, 2026
- Introduce reusable-pr-build.yml that owns all build orchestration
  (common, test-latest-deps, test-native, muzzle, markdown checks, and
  the required-status-check aggregator).
- Convert build-pull-request.yml into a thin dispatcher: it listens to
  pull_request events (including 'labeled' for 'test native', 'test
  openj9', 'test windows') and calls reusable-pr-build.yml with the
  appropriate skip flags.
- Delete rebuild-pull-request-on-label.yml; the dispatcher absorbs its
  role via the 'labeled' trigger and the shared concurrency group.

Branch protection must be updated to require
'build / required-status-check' instead of 'required-status-check'.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file is essentially the old build-pull-request.yml file

diff --git a/.github/workflows/build-pull-request.yml b/.github/workflows/reusable-pr-build.yml
index 57e6027cd0..1a7ae02f52 100644
--- a/.github/workflows/build-pull-request.yml
+++ b/.github/workflows/reusable-pr-build.yml
@@ -1,21 +1,19 @@
-name: Build pull request
+name: Reusable PR build
 
+# Always invoked from build-pull-request.yml (the dispatcher).
+# All gating decisions are made by the dispatcher and passed in as inputs.
 on:
-  pull_request:
-    types:
-      - opened
-      - synchronize
-      - reopened
-  # called from rebuild-pull-request-on-label.yml
   workflow_call:
-
-concurrency:
-  # fixed group name (not github.workflow) so that runs triggered by pull_request
-  # and runs triggered via workflow_call from rebuild-pull-request-on-label.yml
-  # share the group, otherwise the PR build would run twice in parallel whenever
-  # a "test *" label is added
-  group: build-pull-request-${{ github.event.pull_request.number }}
-  cancel-in-progress: true
+    inputs:
+      skip-native-tests:
+        type: boolean
+        default: false
+      skip-openj9-tests:
+        type: boolean
+        default: false
+      skip-windows-smoke-tests:
+        type: boolean
+        default: false
 
 permissions:
   contents: read
@@ -24,9 +22,8 @@ jobs:
   common:
     uses: ./.github/workflows/build-common.yml
     with:
-      # it's rare for only the openj9 tests, openj9 smoke variants, or the windows smoke tests to break
-      skip-openj9-tests: ${{ !contains(github.event.pull_request.labels.*.name, 'test openj9') }}
-      skip-windows-smoke-tests: ${{ !contains(github.event.pull_request.labels.*.name, 'test windows') }}
+      skip-openj9-tests: ${{ inputs.skip-openj9-tests }}
+      skip-windows-smoke-tests: ${{ inputs.skip-windows-smoke-tests }}
       cache-read-only: true
 
   test-latest-deps:
@@ -37,7 +34,7 @@ jobs:
   test-native:
     uses: ./.github/workflows/reusable-native-tests.yml
     with:
-      skip-native-tests: ${{ !contains(github.event.pull_request.labels.*.name, 'test native') }}
+      skip-native-tests: ${{ inputs.skip-native-tests }}
 
   muzzle:
     uses: ./.github/workflows/reusable-muzzle.yml
@@ -61,7 +58,7 @@ jobs:
       - muzzle
       - markdown-lint-check
     runs-on: ubuntu-latest
-    if: always()
+    if: ${{ always() }}
     steps:
       - if: |
           needs.common.result != 'success' ||

@trask trask marked this pull request as ready for review April 26, 2026 00:44
@trask trask requested a review from a team as a code owner April 26, 2026 00:44
@laurit laurit closed this Apr 27, 2026
@laurit laurit reopened this Apr 27, 2026
@trask trask enabled auto-merge (squash) April 27, 2026 14:41
@trask

trask commented Apr 27, 2026

Copy link
Copy Markdown
Member Author

this requires updating the required status check on the branch protections: https://github.com/open-telemetry/admin/pull/627

@trask trask disabled auto-merge April 27, 2026 16:22
@trask trask merged commit 4250c0c into open-telemetry:main Apr 29, 2026
275 of 277 checks passed
@trask trask deleted the pr-workflow branch April 29, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test native This label can be applied to PRs to trigger them to run native tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants