feat(jmanus): support load en | zh system agents #5
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2024-2026 the original author or authors. | |
# | |
# Licensed 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 | |
# | |
# https://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. | |
name: Check Chinese Content in Jmanus | |
on: | |
pull_request: | |
paths: | |
- 'spring-ai-alibaba-jmanus/src/main/java/**/*.java' | |
jobs: | |
check-chinese-content: | |
runs-on: ubuntu-latest | |
name: Check for Chinese content in Java files | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Check Chinese content in Jmanus Java files | |
id: check-chinese | |
run: | | |
cd spring-ai-alibaba-jmanus | |
python scripts/check-chinese-content.py --dir src/main/java --fail-on-found | |
continue-on-error: true | |
- name: Comment on PR if Chinese content found | |
if: steps.check-chinese.outcome == 'failure' | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const fs = require('fs'); | |
const path = require('path'); | |
// Run check script to get detailed information | |
const { exec: execCallback } = require('child_process'); | |
const util = require('util'); | |
const execPromise = util.promisify(execCallback); | |
try { | |
// Re-run check script to get detailed output (without --fail-on-found) | |
const { stdout, stderr } = await execPromise( | |
'cd spring-ai-alibaba-jmanus && python scripts/check-chinese-content.py --dir src/main/java' | |
); | |
const comment = `## π¨ Chinese Content Detected | |
Chinese content has been detected in Java files under | |
\`spring-ai-alibaba-jmanus/src/main/java\` directory. | |
### Check Results: | |
\`\`\` | |
${stdout} | |
${stderr} | |
\`\`\` | |
### Modification Suggestions: | |
1. **Chinese Comments** β Change to English Comments | |
\`\`\`java | |
// β Incorrect Example | |
// θΏζ―δΈδΈͺη¨ζ·ζε‘η±» | |
public class UserService { | |
// β Correct Example | |
// This is a user service class | |
public class UserService { | |
\`\`\` | |
2. **Chinese Strings** β Extract to resource files or use English | |
\`\`\`java | |
// β Incorrect Example | |
throw new RuntimeException("η¨ζ·δΈεε¨"); | |
// β Correct Example | |
throw new RuntimeException("User not found"); | |
// Or use resource files | |
throw new RuntimeException(messageSource.getMessage("user.not.found", null, locale)); | |
\`\`\` | |
3. **Chinese Identifiers** β Change to English Identifiers | |
\`\`\`java | |
// β Incorrect Example | |
String η¨ζ·ε = "admin"; | |
// β Correct Example | |
String username = "admin"; | |
\`\`\` | |
### Why Avoid Chinese Content? | |
- π **Internationalization Friendly**: Facilitates project internationalization and localization | |
- π§ **Development Environment Compatibility**: Avoids encoding issues across different operating systems and IDEs | |
- π₯ **Team Collaboration**: Enables international team members to understand and maintain code | |
- π **Code Standards**: Follows open source project best practices | |
Please modify the relevant files and resubmit. If you have questions, please contact the maintainers.`; | |
await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: comment | |
}); | |
} catch (error) { | |
console.error('Error running check script:', error); | |
const fallbackComment = `## π¨ Chinese Content Detected | |
Chinese content has been detected in Java files under \`spring-ai-alibaba-jmanus/src/main/java\` directory. | |
Please check the following content and modify to English: | |
- Chinese comments β English comments | |
- Chinese strings β English strings or extract to resource files | |
- Chinese identifiers β English identifiers | |
Please resubmit after modifications are complete.`; | |
await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: fallbackComment | |
}); | |
} | |
- name: Fail the workflow if Chinese content found | |
if: steps.check-chinese.outcome == 'failure' | |
run: | | |
echo "β Chinese content found, please check the results above and modify the relevant files" | |
exit 1 | |
- name: Success message | |
if: steps.check-chinese.outcome == 'success' | |
run: | | |
echo "β No Chinese content found, check passed!" |