mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-30 06:16:37 +08:00
压缩历史至 95081aff
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
name: 使用时的错误报告
|
||||
description: 某些事情不按照预期工作。
|
||||
title: "bug: "
|
||||
labels: ["bug"]
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
感谢您花时间填写此 Bug 报告!
|
||||
|
||||
- **提交错误报告前**:请检查 [已有 Issues](https://github.com/linux-do/credit/issues)列表,了解是否有类似问题被报告。如果不确定,请进行搜索,这有助于我们高效地专注于改进项目。
|
||||
- type: checkboxes
|
||||
id: issue-check
|
||||
attributes:
|
||||
label: 检查现有问题
|
||||
description: 确认您在提交新报告之前已经检查了现有报告。
|
||||
options:
|
||||
- label: 我已经搜索了现有问题和讨论。
|
||||
required: true
|
||||
- label: 我正在使用最新版本或 credit.linux.do 上的此应用。
|
||||
required: true
|
||||
- type: textarea
|
||||
id: what-happened
|
||||
attributes:
|
||||
label: 发生了什么?
|
||||
description: 请详细描述您正在进行的操作,您期待看到什么,实际发生了什么。
|
||||
placeholder: 请告诉我们您看到了什么!
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: steps-to-reproduce
|
||||
attributes:
|
||||
label: 如何重现此 Bug?
|
||||
description: 请提供详细的步骤来重现此 Bug。
|
||||
placeholder: |
|
||||
1. 在此环境中...
|
||||
2. 使用此配置...
|
||||
3. 运行 '...'
|
||||
4. 看到错误...
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: browsers
|
||||
attributes:
|
||||
label: 在哪些浏览器中出现问题?
|
||||
multiple: true
|
||||
options:
|
||||
- Firefox
|
||||
- Chrome
|
||||
- Safari
|
||||
- Microsoft Edge
|
||||
- Other (请在“其他信息”中说明)
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: other-info
|
||||
attributes:
|
||||
label: 任何其他信息
|
||||
description: 您有任何其他关于此报告的信息吗?
|
||||
validations:
|
||||
required: false
|
||||
- type: checkboxes
|
||||
id: confirmation
|
||||
attributes:
|
||||
label: 确认
|
||||
description: 确保已满足以下先决条件。
|
||||
options:
|
||||
- label: 我已阅读并遵循了 `README.md` 中的所有说明。
|
||||
required: true
|
||||
- label: 我正在使用 linux-do/credit 的最新版本。
|
||||
required: true
|
||||
- label: 我已提供我能够提供的尽可能多的相关日志,屏幕截图等。
|
||||
required: true
|
||||
- label: |
|
||||
我已详细记录了精确、按顺序且无歧义的逐步重现说明。我的步骤:
|
||||
- 从正在执行的操作开始,
|
||||
- 指定进入了什么页面,
|
||||
- 列出访问的 URL、用户输入(包括所需的示例值/电子邮件/密码),
|
||||
- 描述所有已启用或更改的选项和开关,
|
||||
- 包含任何可能的浏览器控制台日志,
|
||||
- 识别每个阶段的预期和实际结果,
|
||||
- 确保任何有合理技能的用户都可以遵循并遇到相同的问题。
|
||||
required: true
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
## 注意
|
||||
如果 Bug 报告不完整或不遵循说明,则可能不会得到处理。请确保您已遵循所有 **README.md** 指南,并提供所有必要信息以便我们重现该问题。
|
||||
感谢您为 linux-do/credit 做出贡献!
|
||||
@@ -0,0 +1 @@
|
||||
blank_issues_enabled: false
|
||||
@@ -0,0 +1,79 @@
|
||||
name: 新功能建议
|
||||
description: 请求新的功能或对现有功能进行改进。
|
||||
title: "feature: "
|
||||
labels: ["enhancement"]
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
感谢您花时间填写此功能请求!
|
||||
|
||||
- **提交功能请求前**:请检查 [已有 Issues](https://github.com/linux-do/credit/issues) 列表和讨论区,了解是否有类似功能已被讨论或请求。这有助于我们避免重复工作,并高效地专注于改进项目。
|
||||
- type: checkboxes
|
||||
id: check-existing
|
||||
attributes:
|
||||
label: 检查现有问题和讨论
|
||||
description: 确认您在提交新请求之前已经检查了现有报告和讨论。
|
||||
options:
|
||||
- label: 我已经搜索了现有问题和讨论。
|
||||
required: true
|
||||
- label: 我正在使用最新版本或 credit.linux.do 上的此应用。
|
||||
required: true
|
||||
- type: textarea
|
||||
id: feature-description
|
||||
attributes:
|
||||
label: 你希望添加什么功能或改进什么?
|
||||
description: 请详细描述您希望添加的功能或进行的改进。
|
||||
placeholder: 我希望可以...
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: why-needed
|
||||
attributes:
|
||||
label: 为什么需要此功能?
|
||||
description: 请说明此功能解决了什么问题,或提供了什么价值。请提供具体的用例和场景,帮助我们理解其重要性。
|
||||
placeholder: |
|
||||
目前我遇到...
|
||||
如果有了此功能,我可以...
|
||||
这将为用户带来...
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: proposed-solution
|
||||
attributes:
|
||||
label: 建议的解决方案(可选)
|
||||
description: 如果您对如何实现此功能有任何想法,请在此处描述。这可以包括用户界面草图、API 设想、技术方案等。
|
||||
placeholder: |
|
||||
我设想此功能可以通过以下方式实现:
|
||||
1. ...
|
||||
2. ...
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: other-info
|
||||
attributes:
|
||||
label: 任何其他信息
|
||||
description: 您有任何其他关于此报告的信息吗?例如,您目前如何解决这个问题,或者其他类似项目的实现方式等。
|
||||
validations:
|
||||
required: false
|
||||
- type: checkboxes
|
||||
id: confirmation
|
||||
attributes:
|
||||
label: 确认
|
||||
description: 确保已满足以下先决条件。
|
||||
options:
|
||||
- label: 我已阅读并遵循了 `README.md` 中的所有说明。
|
||||
required: true
|
||||
- label: 我正在使用 linux-do/credit 的最新版本。
|
||||
required: true
|
||||
- label: 我已提供我能够提供的尽可能多的相关信息,包括用例和场景。
|
||||
required: true
|
||||
- label: 我理解功能请求的实现取决于项目优先级和资源。
|
||||
required: true
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
## 注意
|
||||
如果功能请求不完整或不遵循说明,则可能不会得到处理。请确保您已提供所有必要信息以便我们理解您的建议。
|
||||
感谢您为 linux-do/credit 做出贡献!
|
||||
@@ -0,0 +1,30 @@
|
||||
## 基础规范
|
||||
|
||||
- 在任何情况都使用简体中文
|
||||
- 你是一个专业的代码助手,专门为 LINUX DO Credit 项目提供代码编写和优化服务
|
||||
- 严格遵循项目的代码规范和最佳实践,确保代码质量和一致性
|
||||
- 保持代码简洁、可读、高效
|
||||
- 优先考虑项目的可维护性、性能和安全性,避免引入不必要的复杂性
|
||||
- 注释和上一行代码之间保留一行空格
|
||||
- 编写代码前仔细分析需求,确保改动有实际价值和意义
|
||||
- 避免仅修改格式、注释或无影响力的拼写错误
|
||||
- 重构代码时必须带来可维护性或功能上的实质提升
|
||||
- 新增功能时考虑向后兼容性和 API 稳定性
|
||||
- 遵循项目的 MIT 许可证要求
|
||||
- 遵循语义化版本控制规范
|
||||
|
||||
## 后端规范
|
||||
|
||||
- 后端开发使用 Go 语言,所有接口需要符合 Restful 风格
|
||||
- 数据库使用 PostgreSQL 作为主存储,Redis 作为缓存和会话存储
|
||||
- Go 代码遵循 gofmt 标准格式,使用 snake_case 命名数据库字段
|
||||
- 所有 API 接口必须编写完整的 Swagger 文档
|
||||
- API 响应格式统一为 {"error_msg": "", "data": {}} 结构
|
||||
- 分页数据返回 {"error_msg": "", "data": {"total": 0, "results": []}} 格式
|
||||
- 数据库设计禁止使用外键,但必须保留对应字段的索引
|
||||
|
||||
## 前端规范
|
||||
|
||||
- TypeScript 代码严禁使用 any 类型,优先使用 unknown 进行类型安全处理
|
||||
- 组件按功能分类:公共组件放在 components/common,UI 组件放在 components/ui
|
||||
- 自定义图标统一放置在 components/icons 目录,常规图标使用 Lucide 库
|
||||
@@ -0,0 +1,3 @@
|
||||
- 如果有其他代码文件,忽略 Swagger 变更和版本号变更,只需要关注其他代码文件的变更
|
||||
- 需要符合 Github 的提交规范,使用 <type>(<scope>): <subject> 格式
|
||||
- Commit Message 必须有 Scope 信息
|
||||
@@ -0,0 +1,25 @@
|
||||
**例行检查**
|
||||
|
||||
<!-- 请在下面的 [ ] 中删除空格并打 x ,表示已完成相关检查 -->
|
||||
|
||||
- [ ] 我已阅读并理解 [贡献者公约](https://github.com/linux-do/credit/blob/master/CODE_OF_CONDUCT.md)
|
||||
- [ ] 我已阅读并同意 [贡献者许可协议 (CLA)](https://github.com/linux-do/credit/blob/master/CLA.md),确认我的贡献将根据项目的 Apache2.0 许可证进行许可
|
||||
- [ ] 我知晓如果此 PR 并不做出实质性更改,或可被认为是*为了PR被合并而提交PR*的,则可能不会被合并
|
||||
|
||||
**关联信息**
|
||||
|
||||
<!--
|
||||
如此 PR 解决了一个 Issue, 请在下方填写
|
||||
resolves #<issue_number>,例如:
|
||||
resolves #1234
|
||||
-->
|
||||
|
||||
<!-- 若以上均没有,请删除此节 -->
|
||||
|
||||
**变更内容**
|
||||
|
||||
<!-- 请在下方简要描述此 PR 的变更内容 -->
|
||||
|
||||
**变更原因**
|
||||
|
||||
<!-- 请在下方简要描述此 PR 的变更原因 -->
|
||||
@@ -0,0 +1,40 @@
|
||||
name: Go Build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ "*" ]
|
||||
push:
|
||||
branches:
|
||||
- "dev"
|
||||
- "main"
|
||||
|
||||
jobs:
|
||||
go_build:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.25"
|
||||
check-latest: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
go mod download
|
||||
go install github.com/swaggo/swag/cmd/swag@v1.16.6
|
||||
|
||||
- name: Make Swagger
|
||||
run: make swagger
|
||||
|
||||
- name: Diff Files
|
||||
run: |
|
||||
if ! git diff --exit-code; then
|
||||
echo 'Detected unstaged changes after command. Please make swagger locally.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Build
|
||||
run: go build main.go
|
||||
@@ -0,0 +1,36 @@
|
||||
name: NextJS Build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ "*" ]
|
||||
push:
|
||||
branches:
|
||||
- "dev"
|
||||
- "main"
|
||||
|
||||
jobs:
|
||||
nextjs_build:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10.10.0
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
cache: 'pnpm'
|
||||
cache-dependency-path: frontend/pnpm-lock.yaml
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: frontend
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build
|
||||
working-directory: frontend
|
||||
run: pnpm build
|
||||
@@ -0,0 +1,200 @@
|
||||
name: Build Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
tags: [ "*" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
FRONTEND_IMAGE_NAME: ${{ github.repository }}-web
|
||||
|
||||
# add permission for package publishing
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
build_image:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
# checkout code
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# set up go
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.25"
|
||||
check-latest: true
|
||||
|
||||
# download Go modules
|
||||
- name: Download Go modules
|
||||
run: go mod download
|
||||
|
||||
# build do
|
||||
- name: Build Go Binary (multi-arch)
|
||||
run: |
|
||||
# build amd64 binary
|
||||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o credit-server-amd64 main.go
|
||||
|
||||
# build arm64 binary
|
||||
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o credit-server-arm64 main.go
|
||||
|
||||
# show binaries
|
||||
ls -alh credit-server-*
|
||||
|
||||
# set up docker buildx
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
# login to registry
|
||||
- name: Log into registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# extract metadata for docker
|
||||
- name: Extract Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=ref,event=tag
|
||||
type=sha,format=short,prefix=
|
||||
|
||||
# build and push docker image
|
||||
- name: Build Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: ${{ github.ref_type == 'tag' || (github.ref == 'refs/heads/master' && github.event_name == 'push') }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
build_frontend_image:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
# checkout code
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# set up docker buildx
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
# login to registry
|
||||
- name: Log into registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# extract metadata for docker (frontend)
|
||||
- name: Extract Docker metadata (frontend)
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE_NAME }}
|
||||
tags: |
|
||||
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=ref,event=tag
|
||||
type=sha,format=short,prefix=
|
||||
|
||||
# generate frontend build date in utc
|
||||
- name: Generate frontend build date
|
||||
id: frontend_build_meta
|
||||
run: echo "build_date=$(date -u +'%Y/%m/%d UTC')" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# build and push frontend docker image with version argument
|
||||
- name: Build Frontend Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./frontend
|
||||
push: ${{ github.ref_type == 'tag' || (github.ref == 'refs/heads/master' && github.event_name == 'push') }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
platforms: linux/amd64
|
||||
build-args: |
|
||||
VERSION=${{ github.ref_type == 'tag' && github.ref_name || '' }}
|
||||
BUILD_DATE=${{ steps.frontend_build_meta.outputs.build_date }}
|
||||
|
||||
update_helm_values:
|
||||
runs-on: ubuntu-24.04
|
||||
needs: [build_image, build_frontend_image]
|
||||
if: github.ref_type == 'tag'
|
||||
steps:
|
||||
# configure SSH agent with deploy key
|
||||
- name: Setup SSH agent
|
||||
uses: webfactory/ssh-agent@v0.9.0
|
||||
with:
|
||||
ssh-private-key: ${{ secrets.DEPLOY_KEY }}
|
||||
|
||||
# add github.com to known_hosts to avoid host verification prompt
|
||||
- name: Add GitHub to known_hosts
|
||||
run: ssh-keyscan github.com >> ~/.ssh/known_hosts
|
||||
|
||||
# clone the helm charts repository
|
||||
- name: Clone Helm Charts repository
|
||||
run: git clone ${{ vars.HELM_CHARTS_REPO }} helm-charts
|
||||
|
||||
# install yq for yaml editing
|
||||
- name: Install yq
|
||||
run: |
|
||||
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
|
||||
sudo chmod +x /usr/local/bin/yq
|
||||
|
||||
# determine helm values file based on tag type (production or test)
|
||||
- name: Determine Helm values file
|
||||
id: helm_config
|
||||
run: |
|
||||
TAG="${{ github.ref_name }}"
|
||||
if [[ $TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "values_file=values/credit/credit.yaml" >> "$GITHUB_OUTPUT"
|
||||
echo "branch_prefix=update/credit" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "values_file=values/credit_test/credit.yaml" >> "$GITHUB_OUTPUT"
|
||||
echo "branch_prefix=update/credit_test" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
# update image tags in helm values file
|
||||
- name: Update image tags in helm values file
|
||||
run: |
|
||||
cd helm-charts
|
||||
yq -i '.image.tag = "${{ github.ref_name }}"' ${{ steps.helm_config.outputs.values_file }}
|
||||
yq -i '.image.webTag = "${{ github.ref_name }}"' ${{ steps.helm_config.outputs.values_file }}
|
||||
|
||||
# commit and push to a new branch, then open a PR for review
|
||||
- name: Commit, push and create PR
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
run: |
|
||||
cd helm-charts
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
BRANCH_NAME="${{ steps.helm_config.outputs.branch_prefix }}-${{ github.ref_name }}"
|
||||
git checkout -b "$BRANCH_NAME"
|
||||
git add ${{ steps.helm_config.outputs.values_file }}
|
||||
git commit -m "chore: update credit image tag to ${{ github.ref_name }}"
|
||||
git push origin "$BRANCH_NAME"
|
||||
HELM_REPO=$(echo "${{ vars.HELM_CHARTS_REPO }}" | sed 's/git@github.com://;s/\.git$//')
|
||||
gh pr create \
|
||||
--repo "${HELM_REPO}" \
|
||||
--title "chore: update credit image tag to ${{ github.ref_name }}" \
|
||||
--body "Automated PR: update \`${{ steps.helm_config.outputs.values_file }}\` image tags to \`${{ github.ref_name }}\` after Docker image build." \
|
||||
--base main \
|
||||
--head "$BRANCH_NAME"
|
||||
@@ -0,0 +1,18 @@
|
||||
name: check license
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
tags: [ "*" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
|
||||
jobs:
|
||||
check_license:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: run make add_license
|
||||
run: make check_license
|
||||
@@ -0,0 +1,24 @@
|
||||
name: Close Ticket
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
|
||||
jobs:
|
||||
close_ticket:
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
- uses: actions/stale@v9
|
||||
with:
|
||||
days-before-issue-stale: 14
|
||||
days-before-issue-close: 14
|
||||
stale-issue-message: "此 issue 长期无活动,将在 14 天后自动关闭。如需继续讨论请回复"
|
||||
close-issue-message: "此 issue 因长期无活动已自动关闭,如有需要请重新开启"
|
||||
days-before-pr-stale: 14
|
||||
days-before-pr-close: 14
|
||||
stale-pr-message: "此 PR 长期无活动,将在 14 天后自动关闭。如需继续讨论请回复"
|
||||
close-pr-message: "此 PR 因长期无活动已自动关闭,如有需要请重新开启"
|
||||
@@ -0,0 +1,40 @@
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ "*" ]
|
||||
push:
|
||||
branches:
|
||||
- "dev"
|
||||
- "main"
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze (${{ matrix.language }})
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
security-events: write
|
||||
packages: read
|
||||
actions: read
|
||||
contents: read
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- language: go
|
||||
build-mode: autobuild
|
||||
- language: javascript-typescript
|
||||
build-mode: none
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
build-mode: ${{ matrix.build-mode }}
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
@@ -0,0 +1,48 @@
|
||||
name: "Copilot Setup Steps"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- .github/workflows/copilot-setup-steps.yml
|
||||
pull_request:
|
||||
paths:
|
||||
- .github/workflows/copilot-setup-steps.yml
|
||||
|
||||
jobs:
|
||||
copilot-setup-steps:
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10.10.0
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
cache: "pnpm"
|
||||
cache-dependency-path: frontend/pnpm-lock.yaml
|
||||
|
||||
- name: Install JavaScript dependencies
|
||||
working-directory: frontend
|
||||
run: pnpm install
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.25"
|
||||
check-latest: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
go mod download
|
||||
go install github.com/swaggo/swag/cmd/swag@v1.16.6
|
||||
@@ -0,0 +1,35 @@
|
||||
name: ESLint
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ "*" ]
|
||||
push:
|
||||
branches:
|
||||
- "dev"
|
||||
- "main"
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10.10.0
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
cache: 'pnpm'
|
||||
cache-dependency-path: frontend/pnpm-lock.yaml
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: frontend
|
||||
run: pnpm install
|
||||
|
||||
- name: Run ESLint
|
||||
working-directory: frontend
|
||||
run: npx eslint . --max-warnings 0
|
||||
@@ -0,0 +1,32 @@
|
||||
name: Check PR Template Checklist
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, edited, synchronize]
|
||||
|
||||
jobs:
|
||||
check-pr-template:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: check all checklist items are checked
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
// get the pull request body
|
||||
const prBody = context.payload.pull_request.body || '';
|
||||
|
||||
// regex to match all checklist items in the template
|
||||
// matches lines like: - [ ] ... or - [x] ...
|
||||
const checklistRegex = /^- \[( |x|X)\] .+$/gm;
|
||||
const matches = prBody.match(checklistRegex) || [];
|
||||
|
||||
// check if any checklist item is not checked
|
||||
const unchecked = matches.filter(line => line.startsWith('- [ ]'));
|
||||
|
||||
// if any unchecked, fail the workflow
|
||||
if (unchecked.length > 0) {
|
||||
core.setFailed(`PR checklist 未全部勾选,请确保所有 checklist 项都已勾选。未勾选项如下:\n${unchecked.join('\n')}`);
|
||||
} else {
|
||||
console.log('all checklist items are checked.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user