-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
179 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# For most projects, this workflow file will not need changing; you simply need | ||
# to commit it to your repository. | ||
# | ||
# You may wish to alter this file to override the set of languages analyzed, | ||
# or to provide custom queries or build logic. | ||
# | ||
# ******** NOTE ******** | ||
# We have attempted to detect the languages in your repository. Please check | ||
# the `language` matrix defined below to confirm you have the correct set of | ||
# supported CodeQL languages. | ||
|
||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ main ] | ||
schedule: | ||
- cron: '18 19 * * 6' | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ 'go' ] | ||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] | ||
# Learn more: | ||
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v3 | ||
with: | ||
languages: ${{ matrix.language }} | ||
# If you wish to specify custom queries, you can do so here or in a config file. | ||
# By default, queries listed here will override any specified in a config file. | ||
# Prefix the list here with "+" to use these queries and those in the config file. | ||
# queries: ./path/to/local/query, your-org/your-repo/queries@main | ||
|
||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). | ||
# If this step fails, then you should remove it and run the build manually (see below) | ||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v3 | ||
|
||
# ℹ️ Command-line programs to run using the OS shell. | ||
# 📚 https://git.io/JvXDl | ||
|
||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines | ||
# and modify them (or add more) to build your code if your project | ||
# uses a compiled language | ||
|
||
#- run: | | ||
# make bootstrap | ||
# make release | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v3 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Check for Chinese Characters | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
check_chinese_comments: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Search for Chinese comments | ||
run: | | ||
set -e | ||
# 搜索中文字符的模式 | ||
pattern='[\u4e00-\u9fff]' | ||
# 创建一个结果文件 | ||
output_file=chinese_comments.txt | ||
: > $output_file | ||
# 使用 grep 查找所有包含中文字符的注释 | ||
grep -Pnr "$pattern" . \ | ||
--exclude-dir={docs,tests,scripts,assets,node_modules,build} \ | ||
--exclude="*.md" --exclude="*.txt" --exclude="*.html" --exclude="*.css" --exclude="*.min.js" \ | ||
|| true | tee -a $output_file | ||
# 如果发现了中文注释,输出注释内容及其位置 | ||
if [ -s $output_file ]; then | ||
echo "Chinese comments found in the following locations:" | ||
cat $output_file | ||
exit 1 | ||
else | ||
echo "No Chinese comments found." | ||
fi | ||
# jobs: | ||
# check-chinese: | ||
# name: Check for Chinese Characters in Code | ||
# runs-on: ubuntu-latest | ||
|
||
# steps: | ||
# - name: Checkout code | ||
# uses: actions/checkout@v4 | ||
|
||
# - name: Scan for Chinese characters | ||
# run: | | ||
# # 检查所有文件中是否包含中文字符并输出所有匹配结果 | ||
# RESULT=$(grep -rn --include=\*.{go,py,js} --exclude-dir={.git,node_modules,html,md} '[\u4e00-\u9fff]' . || true) | ||
# if [ -n "$RESULT" ]; then | ||
# echo "$RESULT" | tee /dev/stderr | ||
# echo "Error: Chinese characters found in the code." | ||
# exit 1 | ||
# else | ||
# echo "No Chinese characters found." | ||
# fi |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Golang Lint Check | ||
|
||
on: | ||
push: | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
resolve-modules: | ||
name: resolve module | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
|
||
- id: set-matrix | ||
run: ./hack/resolve-modules.sh | ||
|
||
lint: | ||
name: lint module | ||
runs-on: ubuntu-latest | ||
needs: resolve-modules | ||
strategy: | ||
matrix: ${{ fromJson(needs.resolve-modules.outputs.matrix) }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Lint | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: v1.54.2 | ||
working-directory: ${{ matrix.workdir }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# 中文测试 | ||
|
||
config: | ||
workflows: true |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package main | ||
|
||
import "fmt" | ||
|
||
func main() { | ||
// 你好 | ||
|
||
fmt.Println("hello") | ||
} |