andygrove commented on code in PR #4292:
URL: https://github.com/apache/datafusion-comet/pull/4292#discussion_r3288463255


##########
.github/workflows/notify_test_workflow.yml:
##########
@@ -0,0 +1,163 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Upstream-side PR notifier.
+#
+# Triggered by pull_request_target on the upstream apache/datafusion-comet
+# repo; runs with the upstream GITHUB_TOKEN (write access to checks). Looks
+# up the corresponding run of build_main.yml on the PR author's fork, then
+# creates a "Build" check run on the PR commit that points to the fork's
+# workflow. A scheduled companion workflow (update_build_status.yml)
+# later PATCHes this check with the fork run's final status and conclusion.
+#
+# The workflow name is intentionally generic — GitHub's check-suite logic
+# associates check runs with an arbitrary workflow in the repo.
+#
+# SECURITY: pull_request_target runs with repo secrets. This script never
+# checks out or executes fork code — it only makes GitHub API calls.
+
+name: On pull request update
+
+on:
+  pull_request_target:
+    types: [opened, reopened, synchronize]
+
+jobs:
+  notify:
+    name: Notify test workflow
+    runs-on: ubuntu-22.04
+    permissions:
+      actions: read
+      checks: write
+    steps:
+      - name: "Notify test workflow"
+        uses: actions/github-script@v7
+        with:
+          github-token: ${{ secrets.GITHUB_TOKEN }}
+          script: |
+            const endpoint = 'GET 
/repos/:owner/:repo/actions/workflows/:id/runs?&branch=:branch'
+            const check_run_endpoint = 'GET 
/repos/:owner/:repo/commits/:ref/check-runs'
+
+            const params = {
+              owner: context.payload.pull_request.head.repo.owner.login,
+              repo: context.payload.pull_request.head.repo.name,
+              id: 'build_main.yml',
+              branch: context.payload.pull_request.head.ref,
+            }
+            const check_run_params = {
+              owner: context.payload.pull_request.head.repo.owner.login,
+              repo: context.payload.pull_request.head.repo.name,
+              ref: context.payload.pull_request.head.ref,
+            }
+
+            console.log('Ref: ' + context.payload.pull_request.head.ref)
+            console.log('SHA: ' + context.payload.pull_request.head.sha)
+
+            // Give the fork push event a moment to start its workflow run.
+            await new Promise(r => setTimeout(r, 3000))

Review Comment:
   notify_test_workflow.yml waits 3 seconds before querying for the fork's run. 
On a slow event-delivery day that may not be enough and
      the contributor lands in the action_required "Workflow run detection 
failed" branch even though their fork CI is fine. Spark's
     equivalent retries with backoff. Worth at least a couple of retries here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to