Skip to content

Commit b46f071

Browse files
committed
Add .github folder structure
1 parent c79d132 commit b46f071

File tree

2 files changed

+13
-30
lines changed

2 files changed

+13
-30
lines changed

.github/script/codearts_check.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ DATA=$(cat <<EOF
4141
"sources" : [ {
4242
"type" : "code",
4343
"params" : {
44-
"git_type" : "git",
44+
"git_type" : "github",
4545
"default_branch" : "main",
4646
"git_url" : "$6",
4747
"endpoint_id" : "$5",

.github/workflows/label-check.yml

+12-29
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,19 @@
1-
name: Check Branch Naming for PRs
1+
name: PR Label Check
22

33
on:
44
pull_request:
5-
types: [opened, synchronize, reopened]
5+
types: [labeled,unlabeled, opened, reopened, edited]
66

77
jobs:
8-
check-branch-naming:
8+
check-label:
99
runs-on: self-hosted
10-
1110
steps:
12-
- name: Checkout code
13-
uses: actions/checkout@v2
14-
15-
- name: Check PR source branch against target branch
16-
run: |
17-
# 获取目标分支和源分支
18-
TARGET_BRANCH="${{ github.base_ref }}"
19-
SOURCE_BRANCH="${{ github.head_ref }}"
20-
21-
echo "Target branch: $TARGET_BRANCH"
22-
echo "Source branch: $SOURCE_BRANCH"
23-
24-
# 检查目标分支是否是 default 分支 (main/master)
25-
if [[ "$TARGET_BRANCH" == "${{ github.event.repository.default_branch }}" ]]; then
26-
if [[ ! "$SOURCE_BRANCH" =~ ^release/.* ]]; then
27-
echo "Error: The source branch must be of the form 'release/*' when merging into the default branch."
28-
exit 1
29-
fi
30-
# 检查目标分支是否是 release/*
31-
elif [[ "$TARGET_BRANCH" =~ ^release/.* ]]; then
32-
if [[ ! "$SOURCE_BRANCH" =~ ^(feature|bugfix)/.* ]]; then
33-
echo "Error: The source branch must be of the form 'feature/*' or 'bugfix/*' when merging into 'release/*'."
34-
exit 1
35-
fi
36-
fi
11+
- name: Check PR Labels
12+
uses: actions/github-script@v6
13+
with:
14+
script: |
15+
const requiredLabel = 'gate_check_pass'; // 替换为你的标签名称
16+
const labels = context.payload.pull_request.labels.map(label => label.name);
17+
if (!labels.includes(requiredLabel)) {
18+
throw new Error(`PR 必须包含标签: ${requiredLabel}`);
19+
}

0 commit comments

Comments
 (0)