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.

fix: Enable auto-approval for sync PRs using correct tokens

LearningCircuit78fde32a4d67
diff --git a/.github/workflows/auto-merge-sync.yml b/.github/workflows/auto-merge-sync.yml
index c81e7f4d12..dc93aed06a 100644
--- a/.github/workflows/auto-merge-sync.yml
+++ b/.github/workflows/auto-merge-sync.yml
@@ -16,27 +16,50 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v5
- - name: Enable auto-merge
+ - name: Auto-approve PR (using PAT from code owner)
+ if: ${{ secrets.PAT_TOKEN }}
+ uses: hmarr/auto-approve-action@v3
+ with:
+ github-token: ${{ secrets.PAT_TOKEN }}
+
+ - name: Comment approval status
uses: actions/github-script@v7
with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const prNumber = context.payload.pull_request.number;
+ const hasPatToken = '${{ secrets.PAT_TOKEN }}' !== '';
+
+ if (hasPatToken) {
+ await github.rest.issues.createComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: prNumber,
+ body: '✅ Auto-approved: Clean sync from main to dev with no conflicts.'
+ });
+
+ // Try to enable auto-merge after approval
+ try {
+ await github.rest.pulls.merge({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ pull_number: prNumber,
+ commit_title: `Automated sync: ${context.payload.pull_request.title}`,
+ commit_message: 'Automatically merged clean sync from main to dev',
+ merge_method: 'merge'
+ });
+ console.log(`Auto-merged PR #${prNumber}`);
+ } catch (error) {
+ console.log(`Could not auto-merge PR #${prNumber}: ${error.message}`);
+ // This might fail if checks haven't passed yet, which is expected
+ }
+ } else {
+ await github.rest.issues.createComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: prNumber,
+ body: '⚠️ **Manual approval required**: Auto-approval needs PAT_TOKEN secret to be configured.\n\nThis is a clean sync from main to dev, but requires manual approval from a code owner.'
+ });
+ }
- await github.rest.pulls.createReview({
- owner: context.repo.owner,
- repo: context.repo.repo,
- pull_number: prNumber,
- event: 'APPROVE',
- body: '✅ Auto-approved: Clean sync with no conflicts detected.'
- });
-
- await github.rest.pulls.merge({
- owner: context.repo.owner,
- repo: context.repo.repo,
- pull_number: prNumber,
- commit_title: `Automated sync: ${context.payload.pull_request.title}`,
- commit_message: 'Automatically merged clean sync from main to dev',
- merge_method: 'merge'
- });
-
- console.log(`Auto-merged PR #${prNumber}`);
+ console.log(`PR #${prNumber} - Auto-approval attempted`);
diff --git a/.github/workflows/sync-main-to-dev.yml b/.github/workflows/sync-main-to-dev.yml
index 85d5cdd2c8..3e3977f02d 100644
--- a/.github/workflows/sync-main-to-dev.yml
+++ b/.github/workflows/sync-main-to-dev.yml
@@ -21,23 +21,14 @@ jobs:
uses: actions/checkout@v5
with:
fetch-depth: 0
- token: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }}
+ # Use GITHUB_TOKEN for checkout so PR is created by github-actions bot
+ token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- # Configure git to use the token for authentication
- if [ -n "${{ secrets.PAT_TOKEN }}" ]; then
- git config --global url."https://x-access-token:${{ secrets.PAT_TOKEN }}@github.com/".insteadOf "https://github.com/"
- fi
-
- # Configure git to use the token for authentication
- if [ -n "${{ secrets.PAT_TOKEN }}" ]; then
- git config --global url."https://x-access-token:${{ secrets.PAT_TOKEN }}@github.com/".insteadOf "https://github.com/"
- fi
-
- name: Check if sync is needed
id: check_sync
run: |
@@ -116,7 +107,9 @@ jobs:
if: steps.check_sync.outputs.sync_needed == 'true'
uses: actions/github-script@v7
with:
- github-token: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }}
+ # Use GITHUB_TOKEN so the PR is created by github-actions[bot]
+ # This allows PAT_TOKEN to approve it later
+ github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const branchName = '${{ steps.create_branch.outputs.branch_name }}';
const hasConflicts = '${{ steps.merge_attempt.outputs.merge_conflicts }}' === 'true';