Skip to content
This repository was archived by the owner on Oct 19, 2026. It is now read-only.

Commit 8a9d3eb

Browse files
authored
Reformt codes and add CodeQL action (#1813)
* Reformt codes and add CodeQL action Signed-off-by: Eli Ma <eli@patch.sh> * Fix the pgp file fmt error Signed-off-by: Eli Ma <eli@patch.sh> * Add deploy workflow conditions Signed-off-by: Eli Ma <eli@patch.sh> --------- Signed-off-by: Eli Ma <eli@patch.sh>
1 parent c5c6ea6 commit 8a9d3eb

204 files changed

Lines changed: 2895 additions & 2622 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/base.yml‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,30 @@ concurrency:
2727

2828
jobs:
2929
format:
30+
if: ${{ github.repository == 'web3infra-foundation/mega' }}
3031
name: Rustfmt Check
3132
runs-on: ubuntu-latest
3233
steps:
3334
- name: Checkout repository
3435
uses: actions/checkout@v4
3536
with:
3637
submodules: recursive
37-
- run: cargo fmt --all -- --check
38+
39+
- name: Install nightly toolchain
40+
run: |
41+
rustup toolchain install nightly --profile minimal
42+
rustup component add rustfmt --toolchain nightly
43+
44+
- run: cargo +nightly fmt --all --check
3845

3946
#
4047
clippy:
48+
if: ${{ github.repository == 'web3infra-foundation/mega' }}
4149
name: Clippy Check
4250
runs-on: ubuntu-latest
4351
env:
4452
CARGO_TERM_COLOR: always
53+
RUSTUP_TOOLCHAIN: stable
4554
steps:
4655
- name: Checkout repository
4756
uses: actions/checkout@v4
@@ -60,6 +69,7 @@ jobs:
6069
6170
test:
6271
name: Full Test
72+
if: ${{ github.repository == 'web3infra-foundation/mega' }}
6373
strategy:
6474
fail-fast: false
6575
matrix:
@@ -71,6 +81,7 @@ jobs:
7181
runs-on: ${{ matrix.runs-on }}
7282
env:
7383
CARGO_TERM_COLOR: always
84+
RUSTUP_TOOLCHAIN: stable
7485
HOME: ${{ matrix.home }}
7586
steps:
7687
- name: Install Redis
@@ -108,9 +119,11 @@ jobs:
108119
109120
fuse:
110121
name: Fuse Clippy Check
122+
if: ${{ github.repository == 'web3infra-foundation/mega' }}
111123
runs-on: [self-hosted, Linux, X64]
112124
env:
113125
CARGO_TERM_COLOR: always
126+
RUSTUP_TOOLCHAIN: stable
114127
steps:
115128
- uses: actions/checkout@v4
116129
- uses: actions-rust-lang/setup-rust-toolchain@v1

‎.github/workflows/claude-review.yml‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,17 @@ jobs:
7676
if: ${{ github.event_name == 'pull_request_target' }}
7777
env:
7878
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
PR_NUMBER: ${{ github.event.pull_request.number }}
80+
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
81+
PR_HEAD_OWNER: ${{ github.event.pull_request.head.repo.owner.login }}
82+
PR_HEAD_REPO: ${{ github.event.pull_request.head.repo.name }}
83+
REPO_OWNER: ${{ github.repository_owner }}
7984
run: |
80-
PR_NUMBER=${{ github.event.pull_request.number }}
81-
HEAD_REF="${{ github.event.pull_request.head.ref }}"
82-
HEAD_OWNER="${{ github.event.pull_request.head.repo.owner.login }}"
83-
HEAD_REPO="${{ github.event.pull_request.head.repo.name }}"
84-
CURRENT_OWNER="${{ github.repository_owner }}"
85+
PR_NUMBER="$PR_NUMBER"
86+
HEAD_REF="$PR_HEAD_REF"
87+
HEAD_OWNER="$PR_HEAD_OWNER"
88+
HEAD_REPO="$PR_HEAD_REPO"
89+
CURRENT_OWNER="$REPO_OWNER"
8590
8691
# For forked PRs, temporarily change origin URL to fork repository
8792
# This allows claude-code-action to fetch the PR branch correctly
@@ -133,7 +138,6 @@ jobs:
133138

134139
# Enable progress tracking and show full Claude output in logs
135140
track_progress: true
136-
show_full_output: true
137141

138142
# Custom review instructions passed to Claude
139143
prompt: |
@@ -172,3 +176,4 @@ jobs:
172176
# Restrict tools that Claude can use during the review
173177
claude_args: |
174178
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"
179+

‎.github/workflows/codeql.yml‎

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL Advanced"
13+
14+
on:
15+
push:
16+
branches: [ "main" ]
17+
pull_request:
18+
branches: [ "main" ]
19+
20+
jobs:
21+
analyze:
22+
name: Analyze (${{ matrix.language }})
23+
# Runner size impacts CodeQL analysis time. To learn more, please see:
24+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
25+
# - https://gh.io/supported-runners-and-hardware-resources
26+
# - https://gh.io/using-larger-runners (GitHub.com only)
27+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
28+
runs-on: 'ubuntu-latest'
29+
permissions:
30+
# required for all workflows
31+
security-events: write
32+
33+
# required to fetch internal or private CodeQL packs
34+
packages: read
35+
36+
# only required for workflows in private repositories
37+
actions: read
38+
contents: read
39+
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
include:
44+
- language: actions
45+
build-mode: none
46+
- language: rust
47+
build-mode: none
48+
- language: javascript-typescript
49+
build-mode: none
50+
steps:
51+
- name: Checkout repository
52+
uses: actions/checkout@v4
53+
54+
# Add any setup steps before running the `github/codeql-action/init` action.
55+
# This includes steps like installing compilers or runtimes (`actions/setup-node`
56+
# or others). This is typically only required for manual builds.
57+
# - name: Setup runtime (example)
58+
# uses: actions/setup-example@v1
59+
60+
# Initializes the CodeQL tools for scanning.
61+
- name: Initialize CodeQL
62+
uses: github/codeql-action/init@v4
63+
with:
64+
languages: ${{ matrix.language }}
65+
build-mode: ${{ matrix.build-mode }}
66+
# If you wish to specify custom queries, you can do so here or in a config file.
67+
# By default, queries listed here will override any specified in a config file.
68+
# Prefix the list here with "+" to use these queries and those in the config file.
69+
70+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
71+
# queries: security-extended,security-and-quality
72+
73+
- name: Perform CodeQL Analysis
74+
uses: github/codeql-action/analyze@v4
75+
with:
76+
category: "/language:${{matrix.language}}"

‎.github/workflows/mega-dev-image-deploy.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ permissions:
2424

2525
jobs:
2626
build-and-push:
27+
if: ${{ github.repository == 'web3infra-foundation/mega' }}
2728
runs-on: ubuntu-latest
2829
timeout-minutes: 30
2930
steps:

‎.github/workflows/mono-engine-deploy.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ concurrency:
2727

2828
jobs:
2929
build:
30+
if: ${{ github.repository == 'web3infra-foundation/mega' }}
3031
runs-on: ubuntu-latest
3132
timeout-minutes: 30
3233
steps:
@@ -67,6 +68,7 @@ jobs:
6768
--push .
6869
6970
deploy:
71+
if: ${{ github.repository == 'web3infra-foundation/mega' }}
7072
needs: build
7173
runs-on: ubuntu-latest
7274
strategy:

‎.github/workflows/orion-client-deploy.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ concurrency:
1414

1515
jobs:
1616
build-and-deploy:
17+
if: ${{ github.repository == 'web3infra-foundation/mega' }}
1718
runs-on: ubuntu-latest
1819
timeout-minutes: 20
1920

‎.github/workflows/orion-server-deploy.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ concurrency:
1717

1818
jobs:
1919
build:
20+
if: ${{ github.repository == 'web3infra-foundation/mega' }}
2021
runs-on: ubuntu-latest
2122
timeout-minutes: 10
2223
steps:
@@ -52,6 +53,7 @@ jobs:
5253
--push .
5354
5455
deploy:
56+
if: ${{ github.repository == 'web3infra-foundation/mega' }}
5557
needs: build
5658
runs-on: ubuntu-latest
5759
strategy:

‎.github/workflows/rag-deploy.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ concurrency:
1818

1919
jobs:
2020
rag-server-deploy:
21+
if: ${{ github.repository == 'web3infra-foundation/mega' }}
2122
runs-on: ubuntu-latest
2223
timeout-minutes: 10
2324
strategy:

‎.github/workflows/web-deploy.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ concurrency:
1919

2020
jobs:
2121
build:
22+
if: ${{ github.repository == 'web3infra-foundation/mega' }}
2223
runs-on: ubuntu-latest
2324
strategy:
2425
matrix:

‎.github/workflows/web-sync-server-deploy.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ concurrency:
2020

2121
jobs:
2222
web-sync-server-deploy:
23+
if: ${{ github.repository == 'web3infra-foundation/mega' }}
2324
runs-on: ubuntu-latest
2425
timeout-minutes: 10
2526
steps:

0 commit comments

Comments
 (0)