You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by as...@apache.org on 2026/08/20 11:25:46 UTC

(maka) 03/03: ci(windows): stop persisting the job credential on the Windows lanes

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

Astro-Han pushed a commit to branch ci/windows-sandbox-w0-narrow-trigger
in repository https://gitbox.apache.org/repos/asf/maka.git

commit c837555fb7f2a325082750170d1ce630ea4b1cf3
Author: AstroHan <le...@outlook.com>
AuthorDate: Thu Aug 20 19:13:04 2026 +0800

    ci(windows): stop persisting the job credential on the Windows lanes
    
    Ten workflows check out the repository and eight of them disable
    persist-credentials. windows-baseline and windows-recovery did not, so both
    left the job token reachable through the checkout's git config for the rest
    of the run — and both then execute npm ci with lifecycle scripts, the desktop
    smoke, and the full storage and runtime suites. Neither pushes, calls gh, or
    reads a token anywhere, so nothing needed it.
    
    Assert the property across the whole directory rather than on the two files
    being fixed, and slice each checkout step so the assertion is per checkout: a
    bare one cannot be balanced out by a sibling step that opts out, or by the
    string appearing in a comment.
    
    Generated-by: Claude Code
---
 .github/workflows/windows-baseline.yml |  2 ++
 .github/workflows/windows-recovery.yml |  2 ++
 scripts/ci-test-plan.test.mjs          | 22 ++++++++++++++++++++++
 3 files changed, 26 insertions(+)

diff --git a/.github/workflows/windows-baseline.yml b/.github/workflows/windows-baseline.yml
index 0772d4af2..e2b5aca90 100644
--- a/.github/workflows/windows-baseline.yml
+++ b/.github/workflows/windows-baseline.yml
@@ -26,6 +26,8 @@ jobs:
       WINDOWS_BASELINE_LOG_DIR: artifacts/windows-baseline
     steps:
       - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+        with:
+          persist-credentials: false
 
       - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
         with:
diff --git a/.github/workflows/windows-recovery.yml b/.github/workflows/windows-recovery.yml
index ec70595c4..b1a374171 100644
--- a/.github/workflows/windows-recovery.yml
+++ b/.github/workflows/windows-recovery.yml
@@ -16,6 +16,8 @@ jobs:
     timeout-minutes: 30
     steps:
       - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+        with:
+          persist-credentials: false
 
       - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
         with:
diff --git a/scripts/ci-test-plan.test.mjs b/scripts/ci-test-plan.test.mjs
index 78d01647c..ab48fa3b9 100644
--- a/scripts/ci-test-plan.test.mjs
+++ b/scripts/ci-test-plan.test.mjs
@@ -226,6 +226,14 @@ test('specialized platform workflows stay reachable without pull requests', () =
   assert.match(baseline, /\n  schedule:/u);
 });
 
+test('workflows never persist the job credential into the checkout', () => {
+  for (const name of readdirSync(WORKFLOW_DIR)) {
+    for (const step of checkoutSteps(name)) {
+      assert.match(step, /persist-credentials: false/u, `${name}: ${step.trim()}`);
+    }
+  }
+});
+
 const WORKFLOW_DIR = new URL('../.github/workflows/', import.meta.url);
 
 function readWorkflow(name) {
@@ -242,3 +250,17 @@ function hasPullRequestTrigger(name) {
 
   return /\bpull_request(_target)?\b/u.test(triggers);
 }
+
+/**
+ * Slices each checkout step from its `uses:` line to the next step, so the
+ * assertion is per checkout: a bare one cannot be balanced out by a sibling
+ * step that opts out, or by the string appearing in a comment.
+ */
+function checkoutSteps(name) {
+  const withoutComments = readWorkflow(name).replaceAll(/^[ \t]*#.*$/gmu, '');
+
+  return (
+    withoutComments.match(/^[ \t]*- uses: actions\/checkout@.*\n(?:(?![ \t]*- )[ \t]+.*\n)*/gmu) ??
+    []
+  );
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org