Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

ci: use dedicated AUTO_MERGE_PAT_TOKEN secret for auto-merge PR updates (#6337)

LearningCircuit6f6709367360
diff --git a/.github/workflows/update-oldest-auto-merge-pr.yml b/.github/workflows/update-oldest-auto-merge-pr.yml
index 6c5d8c8d73..a2fe016d0c 100644
--- a/.github/workflows/update-oldest-auto-merge-pr.yml
+++ b/.github/workflows/update-oldest-auto-merge-pr.yml
@@ -45,10 +45,13 @@ jobs:
- name: Update the selected PR branch
if: ${{ steps.select.outputs.number != '' }}
env:
- # Fork updates require a classic PAT with public_repo + workflow
- # scopes. Keep it confined to this trusted step; unlike GITHUB_TOKEN,
- # it also lets the synchronize event start normal PR CI.
- GH_TOKEN: ${{ secrets.PAT_TOKEN }}
+ # Dedicated automation-owned classic PAT with public_repo and
+ # workflow scopes (classic PATs cannot be restricted to one
+ # repository), separate from the release pipeline's credential.
+ # Fork updates need these scopes; keep the value confined to this
+ # trusted step. Unlike GITHUB_TOKEN, it also lets the synchronize
+ # event start normal PR CI.
+ GH_TOKEN: ${{ secrets.AUTO_MERGE_PAT_TOKEN }}
PR_NUMBER: ${{ steps.select.outputs.number }}
EXPECTED_HEAD_SHA: ${{ steps.select.outputs.head_sha }}
run: |
diff --git a/scripts/ci/update_oldest_auto_merge_pr.py b/scripts/ci/update_oldest_auto_merge_pr.py
index a9d51701b4..e18e8dfbda 100644
--- a/scripts/ci/update_oldest_auto_merge_pr.py
+++ b/scripts/ci/update_oldest_auto_merge_pr.py
@@ -4,8 +4,8 @@
The GitHub Actions workflow invokes this module in two separate steps:
* ``select`` uses the short-lived ``GITHUB_TOKEN`` to list and rank PRs.
-* ``update`` uses ``PAT_TOKEN`` (exposed as ``GH_TOKEN`` only to that step)
- to revalidate one PR and request an update of its branch.
+* ``update`` uses the dedicated ``AUTO_MERGE_PAT_TOKEN`` (exposed as
+ ``GH_TOKEN`` only to that step) to revalidate one PR and update its branch.
Keeping the state transition logic here makes it deterministic and unit
testable without exposing a token or changing a real pull request.
@@ -416,8 +416,8 @@ def update_pull_request(
marker in detail for marker in fork_auth_errors
):
raise UpdaterError(
- "PAT_TOKEN cannot update this editable fork; use a classic "
- "PAT with public_repo and workflow scopes"
+ "AUTO_MERGE_PAT_TOKEN cannot update this editable fork; use "
+ "a classic PAT with public_repo and workflow scopes"
) from exc
raise
try:
@@ -499,7 +499,9 @@ def require_token(command: str) -> None:
"""Fail clearly before invoking ``gh`` when its token is unavailable."""
if os.environ.get("GH_TOKEN"):
return
- token_name = "PAT_TOKEN" if command == "update" else "GITHUB_TOKEN"
+ token_name = (
+ "AUTO_MERGE_PAT_TOKEN" if command == "update" else "GITHUB_TOKEN"
+ )
raise UpdaterError(
f"GH_TOKEN is empty; the workflow must provide {token_name}"
)
diff --git a/tests/ci/test_update_oldest_auto_merge_pr.py b/tests/ci/test_update_oldest_auto_merge_pr.py
index 124c7f362f..d7693bd2ac 100644
--- a/tests/ci/test_update_oldest_auto_merge_pr.py
+++ b/tests/ci/test_update_oldest_auto_merge_pr.py
@@ -476,7 +476,7 @@ def test_cli_fails_before_api_access_when_token_is_missing(monkeypatch, capsys):
assert exit_code == 1
assert api_called is False
- assert "provide PAT_TOKEN" in capsys.readouterr().err
+ assert "provide AUTO_MERGE_PAT_TOKEN" in capsys.readouterr().err
@pytest.fixture(scope="module")
@@ -552,7 +552,9 @@ def test_workflow_keeps_pat_in_update_step_only(workflow):
)
assert select_step["env"] == {"GH_TOKEN": "${{ github.token }}"}
- assert update_step["env"]["GH_TOKEN"] == "${{ secrets.PAT_TOKEN }}"
+ assert (
+ update_step["env"]["GH_TOKEN"] == "${{ secrets.AUTO_MERGE_PAT_TOKEN }}"
+ )
for step in steps:
if step is not update_step:
assert "PAT_TOKEN" not in str(step)