Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
7b4fbf5
initial configuration
Dec 2, 2022
2bca5f0
Merge pull request #1 from hiddenvillage/main
zhongjun2 Dec 5, 2022
cc8c03e
Correct discourse version.
Dec 9, 2022
d8340ac
Merge pull request #9 from hiddenvillage/main
zhongjun2 Dec 9, 2022
9eb4060
add formatting toolbar
Jan 18, 2023
acfe5bb
Change code version.
Jan 29, 2023
e24430f
Merge pull request #10 from hiddenvillage/main
zhongjun2 Jan 29, 2023
a775e2d
Skip git security check.
Jan 30, 2023
65ddfe3
Merge pull request #12 from hiddenvillage/main
zhongjun2 Jan 30, 2023
39ac981
Change branch.
Jan 31, 2023
4dc9cb3
Merge pull request #13 from hiddenvillage/main
zhongjun2 Jan 31, 2023
8eb3ee5
Add translator.
Feb 1, 2023
87efabd
Merge pull request #14 from hiddenvillage/main
zhongjun2 Feb 1, 2023
c74730a
Cancel ratelimit strategies.
Feb 1, 2023
1628edb
Merge pull request #15 from hiddenvillage/main
zhongjun2 Feb 2, 2023
e05ab7e
Change git repo to opensourceways.
Feb 3, 2023
68048a2
Add MaxMind license and Increase sidekiq rss.
Feb 7, 2023
da525a1
Merge pull request #16 from hiddenvillage/main
zhongjun2 Feb 7, 2023
a5444a9
Add "discourse-solved" plugin.
Feb 20, 2023
d2b7373
Merge pull request #17 from hiddenvillage/main
zhongjun2 Feb 20, 2023
d2aa9f5
Merge branch 'main' of github.com:discourse/discourse_docker
Jul 27, 2023
8928036
Update yaml
Jul 28, 2023
1295eeb
Add gamification plugin
Jul 29, 2023
35ec44f
Merge pull request #18 from hiddenvillage/main
zhongjun2 Jul 29, 2023
effdbf2
Add maxminddb_get
Jul 31, 2023
b014da3
Add plugins
Aug 3, 2023
dec4986
Update web_only
Aug 4, 2023
3b42bab
Merge pull request #20 from hiddenvillage/main
zhongjun2 Aug 15, 2023
e088749
Rename repo of easecheck
Sep 21, 2023
f1c2c48
Merge pull request #23 from hiddenvillage/main
zhongjun2 Sep 21, 2023
da026c9
添加多语言管理插件,修改discourse unicorn默认超时时间为60秒
fuxinji9527 Jun 26, 2024
9614ac9
Merge pull request #24 from fuxinji9527/main
zhongjun2 Jun 26, 2024
8609dad
add discourse ai plugin
jlcoo Oct 28, 2024
ce62386
change github plugin
jlcoo Nov 1, 2024
5971ae2
Merge pull request #25 from jlcoo/old_branch
zhongjun2 Nov 1, 2024
3768297
同步最新discourse_docker代码仓
fuxinji9527 Nov 1, 2024
2a79032
Merge pull request #26 from fuxinji9527/main
jlcoo Nov 5, 2024
a9c3ff7
Add .github folder structure
Hourunze1997 Jan 15, 2025
45de8a7
Add username and password credentials (#28)
evie-tao Feb 25, 2025
82ca97b
Add .github folder structure
Hourunze1997 Mar 14, 2025
bd8e06a
multilingual (#32)
jlcoo Mar 17, 2025
fcc9632
Add .github folder structure
Hourunze1997 Mar 26, 2025
91af2fd
Add .github folder structure
Hourunze1997 Mar 27, 2025
92f4861
Specified version (#33)
evie-tao May 8, 2025
dd9ce0a
fix: change version to v3.4.4
jlcoo Jun 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/script/codearts_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/bash
IAM_DATA=$(cat <<EOF
{
"auth": {
"identity": {
"methods": [
"password"
],
"password": {
"user": {
"domain": {
"name": "freesky-edward"
},
"name": "codearts_test",
"password": "$3"
}
}
},
"scope": {
"project": {
"name": "cn-north-4"
}
}
}
}
EOF
)

response=$(curl -s -i --location 'https://iam.myhuaweicloud.com/v3/auth/tokens?nocatalog=true' \
--header 'Content-Type: application/json' \
--data "$IAM_DATA")

# Extract the X-Subject-Token from the response
token=$(echo "$response" | grep "X-Subject-Token" | awk '{print $2}' | tr -d '\r')

echo "X-Subject-Token: $token"


DATA=$(cat <<EOF
{
"sources" : [ {
"type" : "code",
"params" : {
"git_type" : "git",
"default_branch" : "main",
"git_url" : "$6",
"endpoint_id" : "$5",
"build_params" : {
"build_type" : "branch",
"event_type" : "Manual",
"target_branch" : "$1"
}
}
} ],
"description" : "运行描述",
"variables" : [ {
"name" : "repo",
"value" : "$8"
} ,
{
"name" : "owner",
"value" : "$7"
}
,
{
"name" : "pr_id",
"value" : "$2"
}
]
}
EOF
)

CODEARTS_PIPELINE="$4"

curl --location "$CODEARTS_PIPELINE" \
--header "X-Auth-Token:$token" \
--header "Content-Type: application/json" \
--data "$DATA"
84 changes: 84 additions & 0 deletions .github/script/scan_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/bin/bash
IAM_DATA=$(cat <<EOF
{
"auth": {
"identity": {
"methods": [
"password"
],
"password": {
"user": {
"domain": {
"name": "freesky-edward"
},
"name": "codearts_test",
"password": "$3"
}
}
},
"scope": {
"project": {
"name": "cn-north-4"
}
}
}
}
EOF
)

response=$(curl -s -i --location 'https://iam.myhuaweicloud.com/v3/auth/tokens?nocatalog=true' \
--header 'Content-Type: application/json' \
--data "$IAM_DATA")

# Extract the X-Subject-Token from the response
token=$(echo "$response" | grep "X-Subject-Token" | awk '{print $2}' | tr -d '\r')

echo "X-Subject-Token: $token"


DATA=$(cat <<EOF
{
"sources" : [ {
"type" : "code",
"params" : {
"git_type" : "github",
"default_branch" : "main",
"git_url" : "$6",
"endpoint_id" : "$5",
"build_params" : {
"build_type" : "branch",
"event_type" : "Manual",
"target_branch" : "$1"
}
}
} ],
"description" : "运行描述",
"variables" : [ {
"name" : "repo",
"value" : "$8"
} ,
{
"name" : "owner",
"value" : "$7"
}
,
{
"name" : "pr_id",
"value" : "$2"
}
,
{
"name" : "imageUrl",
"value" : "$9"
}
]
}
EOF
)

CODEARTS_PIPELINE="$4"

curl --location "$CODEARTS_PIPELINE" \
--header "X-Auth-Token:$token" \
--header "Content-Type: application/json" \
--data "$DATA"
40 changes: 40 additions & 0 deletions .github/workflows/check-label-owner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Check PR Label Owner

on:
pull_request:
types:
- labeled # 当 PR 被添加标签时触发
jobs:
verify-label-owner:
runs-on: self-hosted

steps:
- name: Check if the label was added by the bot
env:
LABEL_NAME: "gate_check_pass" # 替换为需要检查的标签名称
GITHUB_TOKEN: ${{ secrets.OWNER_TOKEN }}
TARGET_LABEL: "gate_check_pass" # 替换为需要检查的标签名称
AUTHORIZED_USER: "opensourceways-robot" # 替换为允许添加标签的 bot 用户名
run: |

LABEL_NAME=${{ github.event.label.name }}
LABEL_USER=${{ github.event.sender.login }}

# 检查是否有相关事件
if [[ "$LABEL_NAME" != "$TARGET_LABEL" ]]; then
echo "No labeled event found for the label '$TARGET_LABEL'. Exiting."
exit 0
fi

# 检查最近的标签操作者是否为授权用户
if [[ "$LABEL_USER" != "$AUTHORIZED_USER" ]]; then
echo "Label '$LABEL_NAME' was added by '$LABEL_USER', not '$AUTHORIZED_USER'. Removing it."

# 删除标签
curl -X DELETE \
-H "Authorization: token ${{ secrets.OWNER_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels/$TARGET_LABEL
else
echo "Label '$TARGET_LABEL' was added by the authorized user '$AUTHORIZED_USER'. No action needed."
fi
43 changes: 43 additions & 0 deletions .github/workflows/gate-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Gate Check

on:
pull_request:
types: [opened, synchronize, reopened]
# 在PR打开、同步、重新打开时触发
branches:
- main
- master
- release/*

jobs:
codearts-check:
runs-on: self-hosted
steps:
- name: Check and Remove Label
run: |
# 定义需要移除的标签
TARGET_LABEL="gate_check_pass"

# 调用 GitHub API 删除标签
curl -X DELETE \
-H "Authorization: token ${{ secrets.OWNER_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels/$TARGET_LABEL
- name: Checkout repository
uses: actions/checkout@v2

- name: Make script executable
run: chmod +x ./.github/script/codearts_check.sh

- name: Post a comment to the PR
run: |
curl -X POST \
-H "Authorization: token ${{ secrets.OWNER_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
-d '{"body": "开始门禁检查,等门禁检查通过后可以合入"}'

- name: RUN CodeArts Pipeline
env:
GIT_URL: ${{ github.server_url }}/${{ github.repository }}.git
run: ./.github/script/codearts_check.sh $GITHUB_HEAD_REF ${{ github.event.pull_request.number }} ${{ secrets.CODEARTS_PASSWORD }} ${{ secrets.CODEARTS_PIPELINE }} ${{ secrets.CODEARTS_ENDPOINT_ID }} $GIT_URL ${GITHUB_REPOSITORY%/*} ${GITHUB_REPOSITORY##*/}
19 changes: 19 additions & 0 deletions .github/workflows/label-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: PR Label Check

on:
pull_request:
types: [labeled,unlabeled, opened, reopened, edited]

jobs:
check-label:
runs-on: self-hosted
steps:
- name: Check PR Labels
uses: actions/github-script@v6
with:
script: |
const requiredLabel = 'gate_check_pass'; // 替换为你的标签名称
const labels = context.payload.pull_request.labels.map(label => label.name);
if (!labels.includes(requiredLabel)) {
throw new Error(`PR 必须包含标签: ${requiredLabel}`);
}
36 changes: 36 additions & 0 deletions .github/workflows/pr-branch-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Check Branch Naming for PRs

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
check-branch-naming:
runs-on: self-hosted

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Check PR source branch against target branch
run: |
# 获取目标分支和源分支
TARGET_BRANCH="${{ github.base_ref }}"
SOURCE_BRANCH="${{ github.head_ref }}"

echo "Target branch: $TARGET_BRANCH"
echo "Source branch: $SOURCE_BRANCH"

# 检查目标分支是否是 default 分支 (main/master)
if [[ "$TARGET_BRANCH" == "${{ github.event.repository.default_branch }}" ]]; then
if [[ ! "$SOURCE_BRANCH" =~ ^release/.* ]]; then
echo "Error: The source branch must be of the form 'release/*' when merging into the default branch."
exit 1
fi
# 检查目标分支是否是 release/*
elif [[ "$TARGET_BRANCH" =~ ^release/.* ]]; then
if [[ ! "$SOURCE_BRANCH" =~ ^(feature|bugfix)/.* ]]; then
echo "Error: The source branch must be of the form 'feature/*' or 'bugfix/*' when merging into 'release/*'."
exit 1
fi
fi
33 changes: 33 additions & 0 deletions .github/workflows/scan-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Process PR Comment and Run Script

on:
issue_comment:
types: [created] # 仅当评论被创建时触发

jobs:
process_comment:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Make script executable
run: chmod +x ./.github/script/scan_image.sh

- name: Check if comment has the specified prefix and run script
run: |
# 获取评论内容
COMMENT_BODY="${{ github.event.comment.body }}"
PREFIX="扫描镜像:"

# 判断评论是否包含指定的前缀
if [[ "$COMMENT_BODY" == "$PREFIX"* ]]; then
# 去掉前缀并提取后面的内容
IMAGE_URL="${COMMENT_BODY#$PREFIX}"
echo "main" ${{ github.event.issue.number }} ${{ secrets.CODEARTS_PASSWORD }} ${{ secrets.CODEARTS_SCAN_IMAGE_PIPELINE }} ${{ secrets.CODEARTS_ENDPOINT_ID }} "https://github.com/${GITHUB_REPOSITORY}.git" ${GITHUB_REPOSITORY%/*} ${GITHUB_REPOSITORY##*/} "$IMAGE_URL"

./.github/script/scan_image.sh "main" ${{ github.event.issue.number }} ${{ secrets.CODEARTS_PASSWORD }} ${{ secrets.CODEARTS_SCAN_IMAGE_PIPELINE }} ${{ secrets.CODEARTS_ENDPOINT_ID }} "https://github.com/${GITHUB_REPOSITORY}.git" ${GITHUB_REPOSITORY%/*} ${GITHUB_REPOSITORY##*/} "$IMAGE_URL"
else
echo "Comment does not match the prefix, skipping the script execution."
fi
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ shared/*
*.swp
*~
\#*\#
containers/*
# containers/*
cids/*
bin/*
image/.build.out
Expand Down
Loading
Loading