Skip to content

workflow steps separated to go or python - #16561

Merged
JinHai-CN merged 2 commits into
infiniflow:mainfrom
myf-bee:sep-workflow
Jul 2, 2026
Merged

JinHai-CN merged 2 commits into
infiniflow:mainfrom
myf-bee:sep-workflow

Conversation

@myf-bee

@myf-bee myf-bee commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

add new workflow yml, steps separated to go or python

@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jul 2, 2026
@coderabbitai

coderabbitai Bot commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a new GitHub Actions workflow (sep-tests.yml) defining CI triggers, a preflight job for change detection and test-level determination, and two parallel jobs running full test suites (Go, SDK, REST API, CLI) against Infinity and Elasticsearch document engines with coverage and port-conflict handling.

Changes

Sep-tests CI workflow

Layer / File(s) Summary
Triggers and concurrency
.github/workflows/sep-tests.yml
Defines workflow name, read-only permissions, push/PR/schedule triggers, and concurrency cancellation.
Preflight job
.github/workflows/sep-tests.yml
Workspace setup, checkout, duplicate-run detection, linting, test level determination, and change detection outputs for downstream jobs.
Infinity test job
.github/workflows/sep-tests.yml
Builds Go server, runs unit tests, builds Docker image, sets up Python, runs Docker Compose with port reservation, executes SDK/REST/CLI tests with coverage, collects logs, and cleans up.
Elasticsearch test job
.github/workflows/sep-tests.yml
Mirrors the Infinity job for the Elasticsearch engine with engine-specific env vars, port offsets, coverage collection, and final cleanup of coverage files, images, and port locks.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GitHubActions
  participant Preflight
  participant InfinityJob
  participant ElasticsearchJob
  participant Docker

  GitHubActions->>Preflight: trigger on push/PR/schedule
  Preflight->>Preflight: detect changes, determine test level
  Preflight-->>InfinityJob: output flags and test level
  Preflight-->>ElasticsearchJob: output flags and test level
  par Infinity suite
    InfinityJob->>Docker: build image, start compose stack
    InfinityJob->>InfinityJob: run SDK, REST API, CLI tests
    InfinityJob->>Docker: collect logs, cleanup
  and Elasticsearch suite
    ElasticsearchJob->>Docker: build image, start compose stack
    ElasticsearchJob->>ElasticsearchJob: run SDK, REST API, CLI tests
    ElasticsearchJob->>Docker: collect logs, cleanup
  end
Loading

Possibly related PRs

  • infiniflow/ragflow#16133: Both PRs modify GitHub Actions CI workflows to run Infinity and Elasticsearch test suites in parallel with similar compose lifecycle and port reservation mechanics.

Suggested labels: ci, 🧪 test

Poem

A rabbit hops through YAML fields so wide,
Two engines racing, side by side. 🐇
Ports reserved, no clash in sight,
Coverage gathered through the night.
Infinity and Elastic run as one—
CI complete, the tests are done! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description is very brief and lacks the template's requested summary context and purpose. Add a clear Summary section explaining the workflow's purpose, what it changes, and any relevant background or impact.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the workflow change and the Go/Python step split in the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@JinHai-CN
JinHai-CN merged commit 404ef4c into infiniflow:main Jul 2, 2026
12 checks passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
.github/workflows/sep-tests.yml (2)

62-62: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

gh auth login --with-token persists credentials to the runner's home directory.

Using gh auth login writes the token into ~/.config/gh/hosts.yml on the self-hosted runner rather than scoping it to the step. Prefer exporting GH_TOKEN/GITHUB_TOKEN as an env var for the gh invocations in this step, which avoids leaving credentials on disk after the job completes.

🔧 Suggested fix
-            gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}"
-            PR_NUMBER=$(gh pr list --search ${HEAD} --state merged --json number --jq .[0].number)
+            PR_NUMBER=$(gh pr list --search ${HEAD} --state merged --json number --jq .[0].number)

And add at the step level:

        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/sep-tests.yml at line 62, The auth setup in the workflow
step is persisting credentials to disk via gh auth login; update the step that
runs gh commands to use GH_TOKEN or GITHUB_TOKEN from the environment instead of
logging in with --with-token. Locate the affected workflow step by the gh auth
login usage in sep-tests.yml and remove the login command, then add a step-level
env block so gh picks up the token only for that step.

160-193: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

git diff HEAD~1 HEAD can fail on the first commit of a branch/shallow history edge case.

For non-PR, non-schedule events, change detection uses git diff --name-only HEAD~1 HEAD (Line 174). If the triggering commit has no parent reachable in this checkout (e.g., first commit after a force-push/rebase, or squash-merge edge cases), this fails and the whole preflight job errors instead of gracefully falling back to running both Go and Python tests as done in the "no changes detected" branch (Lines 185-188).

🔧 Suggested fix
-              CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD)
+              CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD 2>/dev/null || true)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/sep-tests.yml around lines 160 - 193, The change-detection
step in detect_changes can break on non-PR, non-schedule runs when git diff
HEAD~1 HEAD has no valid parent, causing the job to fail instead of falling back
cleanly. Update the shell logic in the “Detect changed file types” step to
handle this edge case by checking whether the previous commit is available or by
wrapping the diff command in a safe fallback that treats the failure as “unknown
changes” and sets both has_go and has_python to true, consistent with the
existing no-changes fallback.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/sep-tests.yml:
- Around line 49-54: The checkout step in the workflow is persisting credentials
on a self-hosted runner, which can leave the GITHUB_TOKEN available to later
jobs. Update the actions/checkout@v6 usage in the “Check out code” step to
explicitly disable credential persistence by setting persist-credentials to
false. Keep the existing ref, fetch-depth, and fetch-tags settings unchanged.
- Around line 1-3: The workflow’s top-level permissions currently remove the
token scopes needed by the duplicate-check logic, so update the sep-tests
workflow permissions to include the scopes used by the push-only duplicate
check. Specifically, adjust the workflow permissions near the sep-tests header
so the jobs using gh pr list and gh run cancel can run with pull-requests: read
and actions: write while keeping contents: read intact.

---

Nitpick comments:
In @.github/workflows/sep-tests.yml:
- Line 62: The auth setup in the workflow step is persisting credentials to disk
via gh auth login; update the step that runs gh commands to use GH_TOKEN or
GITHUB_TOKEN from the environment instead of logging in with --with-token.
Locate the affected workflow step by the gh auth login usage in sep-tests.yml
and remove the login command, then add a step-level env block so gh picks up the
token only for that step.
- Around line 160-193: The change-detection step in detect_changes can break on
non-PR, non-schedule runs when git diff HEAD~1 HEAD has no valid parent, causing
the job to fail instead of falling back cleanly. Update the shell logic in the
“Detect changed file types” step to handle this edge case by checking whether
the previous commit is available or by wrapping the diff command in a safe
fallback that treats the failure as “unknown changes” and sets both has_go and
has_python to true, consistent with the existing no-changes fallback.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7a6bf674-b93b-4c2e-aa55-77a9626291e4

📥 Commits

Reviewing files that changed from the base of the PR and between 0b9ab12 and ab024cc.

📒 Files selected for processing (1)
  • .github/workflows/sep-tests.yml

Comment on lines +1 to +3
name: sep-tests
permissions:
contents: read

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the workflow and the relevant step that uses gh.
git ls-files .github/workflows/sep-tests.yml
wc -l .github/workflows/sep-tests.yml
cat -n .github/workflows/sep-tests.yml | sed -n '1,220p'

Repository: infiniflow/ragflow

Length of output: 11275


🌐 Web query:

GitHub Actions permissions gh pr list pull-requests: read gh run cancel actions: write GITHUB_TOKEN permissions workflow

💡 Result:

To use the GitHub CLI (gh) within a GitHub Actions workflow with the GITHUB_TOKEN, you must configure the appropriate permissions. Based on the underlying REST API requirements for these commands, the following settings are required: 1. gh pr list: This command requires pull-requests: read permissions [1]. Depending on the specific data being retrieved, it may also require issues: read permissions if the CLI interacts with issue-related metadata for pull requests [1]. 2. gh run cancel: This command requires actions: write permissions [2][3]. This permission is necessary to perform the POST request to the cancel workflow run endpoint [2][4][3]. To implement these in your workflow, use the permissions key within your job or workflow configuration [5][6]. It is a security best practice to follow the principle of least privilege by setting default permissions to none or read-only and explicitly granting only what is required [7][8]. Example Configuration: permissions: pull-requests: read actions: write jobs: my-job: runs-on: ubuntu-latest steps: - name: List PRs run: gh pr list - name: Cancel run run: gh run cancel Note: If your workflow is triggered by a pull request from a forked repository, the GITHUB_TOKEN permissions may be restricted to read-only regardless of your configuration, unless the repository setting 'Send write tokens to workflows from pull requests' is enabled [9][6]. If you require write access in such scenarios without changing repository-wide settings, you may need to use a personal access token (PAT) or a GitHub App installation access token instead [9].

Citations:


🌐 Web query:

site:docs.github.com GitHub Actions workflow permissions pull-requests read actions write gh run cancel gh pr list

💡 Result:

To use GitHub CLI commands within a GitHub Actions workflow, the GITHUB_TOKEN must be configured with specific permissions corresponding to the actions being performed [1][2]. Permissions are defined in the workflow YAML file using the permissions key. If this key is omitted, GitHub defaults to permissive access (or the repository's configured default), but explicitly defining permissions follows the principle of least privilege: any permission not explicitly set to read or write defaults to none [1][3]. Required Permissions: 1. gh run cancel To cancel a workflow run using the GitHub CLI, the GITHUB_TOKEN requires actions: write permission [1][4]. This is because canceling a run modifies the state of the workflow [5][4]. 2. gh pr list To list pull requests using the GitHub CLI, the GITHUB_TOKEN requires pull-requests: read permission [1][6]. This allows the workflow to view pull request data without needing to modify it [1]. Example Configuration: To perform both actions in a single job, your workflow configuration should include: permissions: actions: write pull-requests: read If your workflow requires additional operations, ensure you include the necessary permissions for those as well, as specifying any permission automatically sets all unspecified permissions to none [1]. Note that write access implicitly includes read access for the same scope [1].

Citations:


Add the missing GITHUB_TOKEN scopes for the duplicate-check step

permissions: contents: read clears every other scope, so the gh pr list and gh run cancel calls in the push-only duplicate check will 403 unless this workflow also grants pull-requests: read and actions: write. This breaks the preflight job on push runs.

🔧 Suggested fix
 permissions:
   contents: read
+  actions: write
+  pull-requests: read
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
name: sep-tests
permissions:
contents: read
name: sep-tests
permissions:
contents: read
actions: write
pull-requests: read
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/sep-tests.yml around lines 1 - 3, The workflow’s top-level
permissions currently remove the token scopes needed by the duplicate-check
logic, so update the sep-tests workflow permissions to include the scopes used
by the push-only duplicate check. Specifically, adjust the workflow permissions
near the sep-tests header so the jobs using gh pr list and gh run cancel can run
with pull-requests: read and actions: write while keeping contents: read intact.

Comment on lines +49 to +54
- name: Check out code
uses: actions/checkout@v6
with:
ref: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && format('refs/pull/{0}/merge', github.event.pull_request.number) || github.sha }}
fetch-depth: 0
fetch-tags: true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Missing persist-credentials: false on self-hosted runner checkout.

Static analysis flags credential persistence (artipacked). On a self-hosted runner where the workspace/.git config can outlive the job, a persisted GITHUB_TOKEN in the git credential store increases the risk of token reuse by subsequent code running on the same host.

🔒 Suggested fix
       - name: Check out code
         uses: actions/checkout@v6
         with:
           ref: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && format('refs/pull/{0}/merge', github.event.pull_request.number) || github.sha }}
           fetch-depth: 0
           fetch-tags: true
+          persist-credentials: false
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Check out code
uses: actions/checkout@v6
with:
ref: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && format('refs/pull/{0}/merge', github.event.pull_request.number) || github.sha }}
fetch-depth: 0
fetch-tags: true
- name: Check out code
uses: actions/checkout@v6
with:
ref: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && format('refs/pull/{0}/merge', github.event.pull_request.number) || github.sha }}
fetch-depth: 0
fetch-tags: true
persist-credentials: false
🧰 Tools
🪛 zizmor (1.26.1)

[warning] 49-54: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/sep-tests.yml around lines 49 - 54, The checkout step in
the workflow is persisting credentials on a self-hosted runner, which can leave
the GITHUB_TOKEN available to later jobs. Update the actions/checkout@v6 usage
in the “Check out code” step to explicitly disable credential persistence by
setting persist-credentials to false. Keep the existing ref, fetch-depth, and
fetch-tags settings unchanged.

Source: Linters/SAST tools

xugangqiang pushed a commit to xugangqiang/ragflow that referenced this pull request Jul 3, 2026
add new workflow yml,  steps separated to go or python
xugangqiang pushed a commit to xugangqiang/ragflow that referenced this pull request Jul 6, 2026
add new workflow yml,  steps separated to go or python
@coderabbitai coderabbitai Bot mentioned this pull request Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants