Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: GitHub 官方 Git 教程
url: https://docs.github.com/zh/get-started/using-git/about-git
about: 遇到一般 Git 概念问题时,可以先查阅官方教程。
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/exercise-1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Exercise 1 · 第一次贡献"
description: 练习 Fork、topic branch、commit、push 和第一次 Pull Request
title: "[Exercise 1] "
labels:
- exercise:1
body:
- type: markdown
attributes:
value: |
创建后,机器人会分配一个不会写入 `main` 的专属训练分支,并回复下一步命令。
- type: checkboxes
id: preparation
attributes:
label: 开始前确认
options:
- label: 我会使用自己的 Fork 和独立 topic branch,不直接在 main/master 上练习。
required: true
- label: 我知道连续 14 天无活动时,临时训练分支会被自动清理。
required: true
- type: textarea
id: goal
attributes:
label: 你希望通过本关熟悉什么?
description: 简短写一句即可,不影响自动判定。
placeholder: 例如:我想完整走一次 Fork 到 PR 的流程。
validations:
required: true
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/exercise-2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Exercise 2 · 干净的提交历史"
description: 在一个 PR 中完成两条清晰、线性的提交
title: "[Exercise 2] "
labels:
- exercise:2
body:
- type: markdown
attributes:
value: |
本关要求先完成 Exercise 1。机器人会检查本关恰好有两条提交且没有 merge commit。
- type: checkboxes
id: preparation
attributes:
label: 开始前确认
options:
- label: 我已经完成 Exercise 1。
required: true
- label: 我会从机器人提供的新 base 创建新分支,不复用上一关分支。
required: true
- label: 我知道 commit message 不规范只会收到 Warning,不会阻断练习。
required: true
- type: textarea
id: question
attributes:
label: 当前对提交历史的疑问
placeholder: 没有疑问时可以写“暂无”。
validations:
required: true
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/exercise-3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Exercise 3 · 响应 Code Review"
description: 在同一个 PR 中接收反馈、修改并继续 push
title: "[Exercise 3] "
labels:
- exercise:3
body:
- type: markdown
attributes:
value: |
本关要求先完成 Exercise 2。机器人会在第一次 PR 检查时提出一次必须处理的反馈。
- type: checkboxes
id: preparation
attributes:
label: 开始前确认
options:
- label: 我已经完成 Exercise 2。
required: true
- label: 收到反馈后,我会继续更新原 PR,而不是新建 PR。
required: true
- label: 我会在修改后留言说明如何处理反馈。
required: true
- type: textarea
id: expectation
attributes:
label: 你认为收到 Review 后应该怎么做?
placeholder: 用自己的话简单描述。
validations:
required: true
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/exercise-4.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "Exercise 4 · 解决上游冲突"
description: 处理机器人在专属上游分支制造的真实冲突
title: "[Exercise 4] "
labels:
- exercise:4
body:
- type: markdown
attributes:
value: |
本关要求先完成 Exercise 3。PR 创建后,机器人会更新上游同一行以制造真实冲突。
- type: checkboxes
id: preparation
attributes:
label: 开始前确认
options:
- label: 我已经完成 Exercise 3。
required: true
- label: 我会在本地 fetch 上游,并使用 merge 或 rebase 解决冲突。
required: true
- label: 我不会直接删除其中一方的内容来绕过冲突。
required: true
- type: dropdown
id: strategy
attributes:
label: 计划使用的方式
options:
- merge(更适合第一次练习)
- rebase
- 还不确定,等机器人提示
validations:
required: true
7 changes: 0 additions & 7 deletions .github/ISSUE_TEMPLATE/exercise1.md

This file was deleted.

28 changes: 0 additions & 28 deletions .github/ISSUE_TEMPLATE/exercise2.md

This file was deleted.

29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/improvement.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: 改进这个训练仓库
description: 报告文档问题、自动化缺陷或提出课程建议
title: "[Improvement] "
labels:
- enhancement
body:
- type: dropdown
id: area
attributes:
label: 涉及范围
options:
- 课程文档
- GitHub Actions / 自动反馈
- Issue / PR 模板
- 其他
validations:
required: true
- type: textarea
id: problem
attributes:
label: 当前问题
description: 请描述你遇到的行为和期望行为。
validations:
required: true
- type: textarea
id: proposal
attributes:
label: 建议方案
description: 可选;不需要先写代码。
19 changes: 19 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## 练习说明

- 本次练习:Exercise <!-- 填写 1/2/3/4 -->
- 我完成了:<!-- 简短说明 -->

## 关联 Issue

Closes #<!-- 填写机器人分配的 Issue 编号 -->

## 自查

- [ ] base 是机器人提供的 `practice/ex...` 临时分支
- [ ] head 是我 Fork 中的独立 topic branch,不是 `main`/`master`
- [ ] 只修改了 `.practice/workspace.md`
- [ ] 我会继续更新这个 PR,而不是为修复反馈新建 PR

## 给维护者或机器人的备注

<!-- 没有时可写“无” -->
18 changes: 18 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Summary

- 做了什么:
- 为什么这样做:

## Related Issue

<!-- 例如:Closes #123;不应关闭 Issue 时请说明原因。 -->

## Test Plan

- [ ] `npm test`
- [ ] `npm run check:source`
- [ ] 文档中的命令和链接已人工检查

## Notes

<!-- 风险、兼容性、后续工作或截图。 -->
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
open-pull-requests-limit: 5
commit-message:
prefix: "ci(deps)"
72 changes: 72 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: CI

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
tests:
name: CI / Tests
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false

- name: Set up Node.js
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version: "22"
cache: npm

- name: Install dependencies
run: npm ci --ignore-scripts

- name: Run unit and source checks
run: npm run check

- name: Check whitespace errors
run: git diff --check

workflow-lint:
name: CI / Workflow lint
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false

- name: Install pinned actionlint
env:
ACTIONLINT_VERSION: "1.7.12"
run: |
curl --fail --silent --show-error --location --remote-name "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz"
curl --fail --silent --show-error --location --remote-name "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_checksums.txt"
grep " actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz$" "actionlint_${ACTIONLINT_VERSION}_checksums.txt" | sha256sum --check --strict
tar --extract --gzip --file "actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz" actionlint
./actionlint -color

security:
name: CI / Workflow security
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false

- name: Set up Node.js
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version: "22"

- name: Verify privileged workflow boundaries and pinned actions
run: node scripts/practice/check-source.mjs
50 changes: 0 additions & 50 deletions .github/workflows/exercise.yml

This file was deleted.

Loading