Skip to content

Commit

Permalink
feat:添加GitHub workflows与issues template
Browse files Browse the repository at this point in the history
  • Loading branch information
mason369 committed Apr 11, 2023
1 parent d7dc03b commit be3452d
Show file tree
Hide file tree
Showing 16 changed files with 1,487 additions and 34 deletions.
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: 错误报告
about: 创建报告以帮助我们改进
title: ''
labels: ''
assignees: ''

---

**描述错误**
清晰简明地描述错误的内容。

**重现步骤**
重现行为的步骤:
1. 进入“...”
2. 点击“...”
3. 滚动至“...”
4. 查看错误

**期望行为**
清晰简明地描述你期望发生的情况。

**屏幕截图**
如果可用,添加屏幕截图以帮助解释您的问题。

**桌面设备(请填写以下信息):**
- 操作系统:[例如iOS]
- 浏览器:[例如Chrome、Safari]
- 版本:[例如22]

**手机设备(请填写以下信息):**
- 设备:[例如iPhone6]
- 操作系统:[例如iOS8.1]
- 浏览器:[例如默认浏览器、Safari]
- 版本:[例如22]

**其他上下文**
在此处添加有关问题的任何其他上下文。
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: 功能请求
about: 为此项目提出建议
title: ''
labels: ''
assignees: ''

---

**您的功能请求是否与问题有关?请描述。**
清晰简明地描述问题是什么。例如:我总是感到沮丧,因为[...]

**描述您想要的解决方案**
清晰简明地描述您希望发生的情况。

**描述您考虑过的替代方案**
清晰简明地描述您考虑过的任何替代解决方案或功能。

**其他上下文**
在此处添加有关功能请求的任何其他上下文或屏幕截图。
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
day: saturday
time: "15:00"
timezone: Asia/Shanghai
open-pull-requests-limit: 10
29 changes: 29 additions & 0 deletions .github/workflows/Code-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Code Review
on:
pull_request:
branches: [ main ] # 只有针对主分支的 PR 会触发此工作流程

jobs:
code-review:
name: Code Review
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3 # 检查代码库,将其检出到 runner 中
- name: Setup Node.js
uses: actions/setup-node@v3 # 安装 Node.js 运行环境和依赖包
with:
node-version: '12.x'
- name: Install dependencies
run:
npm install
npm i vitepress -D
npm run docs:build
- name: Setup code review
uses: reviewdog/action-eslint@v1 # 使用 reviewdog 工具进行代码审查
with:
github_token: ${{ secrets.GITHUB_TOKEN }} # 授权访问 GitHub API
eslint_level: error # 设置 Eslint 输出级别为 error

# 这个 workflow 文件使用 `pull_request` 事件来监听新的 PR 提交,并且只有针对主分支的操作才会触发它。code-review job 使用 `actions/checkout` action 将代码库检出到 runner 中,使用 `actions/setup-node` action 安装 Node.js 运行环境和依赖包,接着通过运行 `npm run lint` 进行代码风格检查和运行 `npm test` 命令来运行测试。最后,在 Setup code review 步骤中,我们使用 `reviewdog/action-eslint` action 来进行代码审查,并将输出级别设置为 `error`。
#
# 需要注意的是,在此示例中,我们使用了 Eslint 工具来进行代码风格检查。如果您的项目使用其他工具或规则,请相应地更改该命令或引用其他 action。
20 changes: 20 additions & 0 deletions .github/workflows/First-interaction.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: First interaction

on:
issues:
types: [opened]
pull_request_target:
types: [opened]

jobs:
welcome:
runs-on: ubuntu-latest
steps:
- name: Welcome new contributor
uses: actions/[email protected]
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: |
你好呀!感谢您打开我们项目的第一期。感谢您的反馈,并期待尽快解决此问题。
pr-message: |
恭喜你打开了你的第一个拉取请求!我们的团队将很快对其进行审核并提供任何必要的反馈。感谢您为我们的项目做出贡献!
58 changes: 58 additions & 0 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Auto Merge
on:
pull_request:
types:
- labeled
- unlabeled
- synchronize
- opened
- edited
- ready_for_review
- reopened
- unlocked
pull_request_review:
types:
- submitted
status: { }

# 定义作业 jobs,包括检查 PR 合规性和自动合并发布版本的 PR 到 master 分支两个步骤
jobs:

# 检查 PR 合规性
check:
runs-on: ubuntu-latest # 运行环境为最新版 ubuntu

# 步骤,包括代码 checkout、Node.js 环境设置、依赖安装、代码 lint、单元测试等操作
steps:
- name: Checkout code # 步骤名称为:Checkout code
uses: actions/checkout@v3 # 使用 actions/checkout 动作

- name: Setup Node.js environment # 步骤名称为:Setup Node.js environment
uses: actions/setup-node@v3 # 使用 actions/setup-node 动作安装 Node.js 环境
with:
node-version: '14.x'

- name: Install dependencies # 步骤名称为:Install dependencies
run: |# 安装依赖
npm install
npm i vitepress -D
# - name: Lint code # 步骤名称为:Lint code
# run: |# 执行 lint 命令
# npm run lint
- name: Run unit tests # 步骤名称为:Run unit tests
run: |# 执行单元测试,如果没有测试用例返回 0
npm run test || exit 0
# 合并发布版本的 PR 到 master 分支
auto-merge:
runs-on: ubuntu-latest # 运行环境为最新版 ubuntu

# 步骤,使用 pascalgn/automerge-action 动作实现自动合并发布版本的 PR 到 master 分支,并定义了环境变量 GITHUB_TOKEN 和 MERGE_FILTER_AUTHOR 条件过滤器。
steps:
- name: Automerge # 步骤名称为:Automerge
uses: pascalgn/[email protected] # 使用 pascalgn/automerge-action 动作进行自动合并 PR 操作
env:
GITHUB_TOKEN: '${{ secrets.RELEASE_TOKEN }}' # 设置 GitHub Token 密钥,从 secrets 中获取
MERGE_LABELS: ''
MERGE_FILTER_AUTHOR: 'LingASDJ' # 只有作者是 mason369 的 PR 才会被自动合并。
55 changes: 55 additions & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: build-and-deploy

on:
push:
branches: [ main ]

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false

- name: Install and Build
run: |
npm install
npm i vitepress -D
npm run docs:build
- name: Deploy
uses: JamesIves/[email protected]
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages
FOLDER: dist
# 判断工作流是否全部成功,如果有任意一个步骤失败,则发送失败邮件;否则发送成功邮件。
# - name: Send Mail 发送邮件
# if: ${{ !cancelled() && success() }}
# uses: bingblue/send-nodemailer@master
# with:
# user: '${{ secrets.EMAIL_USERNAME }}'
# pass: '${{ secrets.EMAIL_PASSWORD }}'
# host: 'smtp.gmail.com'
# port: 465
# secure: true
# from: '构建与部署 <[email protected]>'
# to: [email protected],[email protected]
# subject: 'Success:部署成功!'
# html: '<h2>构建部署执行完毕!</h2>'
# - name: Send Mail 发送邮件
# if: ${{ !cancelled() && failure() }}
# uses: bingblue/send-nodemailer@master
# with:
# user: '${{ secrets.EMAIL_USERNAME }}'
# pass: '${{ secrets.EMAIL_PASSWORD }}'
# host: 'smtp.gmail.com'
# port: 465
# secure: true
# from: '构建与部署 <[email protected]>'
# to: [email protected],[email protected]
# subject: 'Failed:部署失败'
# html: '<h2>部署失败请重新检查代码。</h2>'
17 changes: 17 additions & 0 deletions .github/workflows/reademe-contributors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 监听 main 分支
name: Contributes
on:
push:
branches:
- main

jobs:
# 任务
contrib-readme-en-job:
runs-on: ubuntu-latest
name: A job to automate contrib in readme
steps:
- name: Contribute List
uses: akhilmhdh/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.CONTRIBUTORS_TOKEN }}
17 changes: 17 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Release
on:
push:
branches:
- main

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: GoogleCloudPlatform/release-please-action@v3
id: release
with:
token: ${{ secrets.RELEASE_TOKEN }}
release-type: node
package-name: standard-version
changelog-types: '[{"type": "types", "section":"Types", "hidden": false},{"type": "revert", "section":"Reverts", "hidden": false},{"type": "feat", "section": "Features", "hidden": false},{"type": "fix", "section": "Bug Fixes", "hidden": false},{"type": "improvement", "section": "Feature Improvements", "hidden": false},{"type": "docs", "section":"Docs", "hidden": false},{"type": "style", "section":"Styling", "hidden": false},{"type": "refactor", "section":"Code Refactoring", "hidden": false},{"type": "perf", "section":"Performance Improvements", "hidden": false},{"type": "test", "section":"Tests", "hidden": false},{"type": "build", "section":"Build System", "hidden": false},{"type": "ci", "section":"CI", "hidden":false},{"type": "update", "section":"update", "hidden":false},{"type": "Update", "section":"Update", "hidden":false},{"type": "mods", "section":"MODS", "hidden":false},{"type": "mod", "section":"MOD", "hidden":false},{"type": "更新", "section":"更新", "hidden":false},{"type": "del", "section":"Delete", "hidden":false}]'
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
* RW API Code是一个非官方的第三方RustedWarfare代码网站,提供高效和高度学习的服务态度。
* 如果您想合作开发,请Fork我们的主要分支机构并申请PullRecust

### 贡献者

<!-- readme: collaborators,contributors -start -->
<!-- readme: collaborators,contributors -end -->

# 开发说明
## 1.前提条件:Node.js 18或以上
```文本
Expand Down
Loading

0 comments on commit be3452d

Please sign in to comment.