This is an automated email from the ASF dual-hosted git repository.

nchammas pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-4.1 by this push:
     new 5a14678019e1 [SPARK-60578][INFRA] Migrate build status workflow off of 
`pull_request_target` trigger
5a14678019e1 is described below

commit 5a14678019e16ff5150b60d6a81070aef157f50f
Author: Nicholas Chammas <[email protected]>
AuthorDate: Tue Nov 3 17:05:59 2026 -0500

    [SPARK-60578][INFRA] Migrate build status workflow off of 
`pull_request_target` trigger
    
    ### What changes were proposed in this pull request?
    
    Remove `notify_test_workflow.yml` and rely on the existing 
`update_build_status.yml` to report fork build status on PRs. Update the 
comments accordingly.
    
    This builds on 
[apache/spark#58579](https://github.com/apache/spark/pull/58579) (SPARK-59293), 
which fixes errors that abort the scheduled scan.
    
    ### Why are the changes needed?
    
    ASF is disabling the `pull_request_target` trigger in [November 2026][asf], 
ahead of GitHub's [December 2 deadline][github]. This is our only workflow 
using it.
    
    The scheduled updater already creates missing `Build` checks (SPARK-58660), 
so we don't need another workflow to replace the notifier. Fork builds still 
run on push, as usual; this PR only changes how their status gets reported.
    
    We should backport this PR to active maintenance branches that accept PRs, 
since `pull_request_target` uses the base branch's workflow.
    
    [asf]: https://infra.apache.org/github-actions-policy.html
    [github]: 
https://docs.github.com/en/actions/reference/security/securely-using-pull_request_target#default-policy-for-pull_request_target
    
    I intentionally kept this PR simple as I _really_ don't like that we have 
to maintain so much GitHub Actions-specific JavaScript just to manage our 
fork-based contribution workflow.
    
    In other words, in the interest of simplicity I intentionally left out:
    - Any mechanism to update PRs "live".
    - Testing infrastructure for these workflows and the JavaScript they 
contain.
    
    This infrastructure is not in the Spark project's area of expertise. It 
really feels like something we should be able to import and use from somewhere. 
Until then, I think we should strive to keep these workflows as simple as 
possible.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No, nothing for end users.
    
    For contributors here on GitHub:
    
    - The "Notify test workflow" check goes away.
    - New `Build` checks appear as `queued` on the first scheduled pass and 
pick up the fork result on the next. The schedule is every 15 minutes, but 
GitHub can delay or drop runs.
    - If you push multiple updates to a PR between scans, only the latest 
commit gets a `Build` check.
    - The results link opens the fork's Actions run instead of its `Run / Check 
changes` check.
    
    ### How was this patch tested?
    
    Checked locally with actionlint, YAML parsing, and git diff --check.
    
    `update_build_status.yml` changes only comments, so the scheduled updater, 
which runs from master, already behaves as it will after this PR. In [run 
40517915808](https://github.com/apache/spark/actions/runs/40517915808) it 
created Build checks for PRs that had none (#54953, #59831), and later 
scheduled runs synced them (#54953 is now success).
    
    Additionally, an agent replayed the unmodified updater against 150 open PRs 
with their Build checks hidden and writes intercepted: all 150 resolve to the 
same fork run, and the 36 action_required PRs would get identical checks. All 
708 open master PRs currently have exactly one Build check, and 706 match their 
fork run.
    
    This PR can't fully test itself because `pull_request_target` runs the base 
branch's copy of the notifier. I will run additional tests post merge.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    Generated-by: Copilot SDK in VS Code (version unavailable)
    
    Closes #59829 from nchammas/pr-target-actions-policy.
    
    Authored-by: Nicholas Chammas <[email protected]>
    Signed-off-by: Nicholas Chammas <[email protected]>
    (cherry picked from commit 6a02fc4e8e5c9c34cfdf01b31fefcf84589a2298)
    Signed-off-by: Nicholas Chammas <[email protected]>
---
 .github/workflows/notify_test_workflow.yml | 168 -----------------------------
 1 file changed, 168 deletions(-)

diff --git a/.github/workflows/notify_test_workflow.yml 
b/.github/workflows/notify_test_workflow.yml
deleted file mode 100644
index 93b627763445..000000000000
--- a/.github/workflows/notify_test_workflow.yml
+++ /dev/null
@@ -1,168 +0,0 @@
-#
-# 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.
-#
-
-# Intentionally has a general name.
-# because the test status check created in GitHub Actions
-# currently randomly picks any associated workflow.
-# So, the name was changed to make sense in that context too.
-# See also 
https://github.community/t/specify-check-suite-when-creating-a-checkrun/118380/10
-name: On pull request update
-on:
-  pull_request_target:
-    types: [opened, reopened, synchronize]
-
-jobs:
-  notify:
-    name: Notify test workflow
-    runs-on: ubuntu-latest
-    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?per_page=100'
-
-            // TODO: Should use pull_request.user and 
pull_request.user.repos_url?
-            // If a different person creates a commit to another forked repo,
-            // it wouldn't be able to detect.
-            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)
-
-            // Wait 3 seconds to make sure the fork repository triggered a 
workflow.
-            await new Promise(r => setTimeout(r, 3000))
-
-            let runs
-            try {
-              runs = await github.request(endpoint, params)
-            } catch (error) {
-              console.error(error)
-              // Assume that runs were not found.
-            }
-
-            const name = 'Build'
-            const head_sha = context.payload.pull_request.head.sha
-            let status = 'queued'
-
-            if (!runs || runs.data.workflow_runs.length === 0) {
-              status = 'completed'
-              const conclusion = 'action_required'
-
-              github.rest.checks.create({
-                owner: context.repo.owner,
-                repo: context.repo.repo,
-                name: name,
-                head_sha: head_sha,
-                status: status,
-                conclusion: conclusion,
-                output: {
-                  title: 'Workflow run detection failed',
-                  summary: `
-            Unable to detect the workflow run for testing the changes in your 
PR.
-
-            1. If you did not enable GitHub Actions in your forked repository, 
please enable it by clicking the button as shown in the image below. See also 
[Managing Github Actions Settings for a 
repository](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository)
 for more details.
-            2. It is possible your branch is based on the old \`master\` 
branch in Apache Spark, please sync your branch to the latest master branch. 
For example as below:
-                \`\`\`bash
-                git fetch upstream
-                git rebase upstream/master
-                git push origin YOUR_BRANCH --force
-                \`\`\``,
-                  images: [
-                    {
-                      alt: 'enabling workflows button',
-                      image_url: 
'https://raw.githubusercontent.com/apache/spark/master/.github/workflows/images/workflow-enable-button.png'
-                    }
-                  ]
-                }
-              })
-            } else {
-              const run_id = runs.data.workflow_runs[0].id
-
-              if (runs.data.workflow_runs[0].head_sha != 
context.payload.pull_request.head.sha) {
-                throw new Error('There was a new unsynced commit pushed. 
Please retrigger the workflow.');
-              }
-
-              // Here we get check run ID to provide Check run view instead of 
Actions view, see also SPARK-37879.
-              let retryCount = 0;
-              let check_run_head;
-              while (retryCount < 3) {
-                const check_runs = await github.request(check_run_endpoint, 
check_run_params);
-                check_run_head = check_runs.data.check_runs.find(r => r.name 
=== "Run / Check changes");
-                if (check_run_head) {
-                  break;
-                }
-                retryCount++;
-                if (retryCount < 3) {
-                  await new Promise(resolve => setTimeout(resolve, 3000));
-                }
-              }
-              if (!check_run_head) {
-                throw new Error('Failed to retrieve check_run_head after 3 
attempts');
-              }
-
-              if (check_run_head.head_sha != 
context.payload.pull_request.head.sha) {
-                throw new Error('There was a new unsynced commit pushed. 
Please retrigger the workflow.');
-              }
-
-              const check_run_url = 'https://github.com/'
-                + context.payload.pull_request.head.repo.full_name
-                + '/runs/'
-                + check_run_head.id
-              console.log('Check run URL: ' + check_run_url)
-
-              const actions_url = 'https://github.com/'
-                + context.payload.pull_request.head.repo.full_name
-                + '/actions/runs/'
-                + run_id
-              console.log('Actions URL: ' + actions_url)
-
-              github.rest.checks.create({
-                owner: context.repo.owner,
-                repo: context.repo.repo,
-                name: name,
-                head_sha: head_sha,
-                status: status,
-                output: {
-                  title: 'Test results',
-                  summary: '[See test results](' + check_run_url + ')',
-                  text: JSON.stringify({
-                    owner: context.payload.pull_request.head.repo.owner.login,
-                    repo: context.payload.pull_request.head.repo.name,
-                    run_id: run_id
-                  })
-                },
-                details_url: actions_url,
-              })
-            }


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

Reply via email to