generated from IntensiveCoLearning/template
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6afc7d6
Showing
4 changed files
with
792 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
name: Repo Management | ||
|
||
on: | ||
pull_request_target: | ||
types: [closed] | ||
schedule: | ||
- cron: "0 0 * * *" # 每天午夜运行 | ||
push: | ||
branches: [main] # 每次推送到main分支时也运行 | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
invite-contributor: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'pull_request_target' && github.event.pull_request.merged == true | ||
steps: | ||
- name: Invite contributor | ||
id: invite-contributor | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.PAT_WITH_INVITE_PERMISSIONS }} | ||
script: | | ||
const { owner, repo } = context.repo; | ||
const username = context.payload.pull_request.user.login; | ||
console.log(`Checking if ${username} is already a collaborator...`); | ||
try { | ||
const { data: permissionLevel } = await github.rest.repos.getCollaboratorPermissionLevel({ | ||
owner, | ||
repo, | ||
username, | ||
}); | ||
if (permissionLevel.permission === 'admin' || permissionLevel.permission === 'write') { | ||
console.log(`${username} is already a collaborator with sufficient permissions.`); | ||
return; | ||
} | ||
console.log(`${username} is a collaborator but needs permission update.`); | ||
} catch (error) { | ||
if (error.status !== 404) { | ||
console.error(`Error checking collaborator status: ${error.message}`); | ||
throw error; | ||
} | ||
console.log(`${username} is not a collaborator.`); | ||
} | ||
try { | ||
console.log(`Inviting ${username} as a collaborator...`); | ||
const response = await github.rest.repos.addCollaborator({ | ||
owner, | ||
repo, | ||
username, | ||
permission: 'push' | ||
}); | ||
if (response.status === 201) { | ||
console.log(`Invitation sent to ${username} as a collaborator with push permission.`); | ||
core.setOutput('invitation_sent', 'true'); | ||
} else if (response.status === 204) { | ||
console.log(`${username}'s permissions updated to push.`); | ||
core.setOutput('invitation_sent', 'false'); | ||
} | ||
} catch (error) { | ||
console.error(`Error inviting/updating collaborator: ${error.message}`); | ||
core.setFailed(`Error inviting/updating collaborator: ${error.message}`); | ||
} | ||
- name: Comment on PR | ||
if: steps.invite-contributor.outputs.invitation_sent == 'true' | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const { owner, repo } = context.repo; | ||
const issue_number = context.payload.pull_request.number; | ||
const username = context.payload.pull_request.user.login; | ||
try { | ||
await github.rest.issues.createComment({ | ||
owner, | ||
repo, | ||
issue_number, | ||
body: `Thanks for your contribution, @${username}! You've been invited as a collaborator with push permissions. Please check your email for the invitation.` | ||
}); | ||
console.log(`Comment posted on PR #${issue_number}`); | ||
} catch (error) { | ||
console.error(`Error posting comment: ${error.message}`); | ||
core.setFailed(`Error posting comment: ${error.message}`); | ||
} | ||
update-readme: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'schedule' || github.event_name == 'push' | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.x" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install PyGithub pytz | ||
- name: Update README | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
START_DATE: ${{ vars.START_DATE }} | ||
END_DATE: ${{vars.END_DATE }} | ||
FILE_SUFFIX: ${{vars.FILE_SUFFIX}} | ||
FIELD_NAME: ${{vars.FIELD_NAME}} | ||
run: python sync_status_readme.py | ||
- name: Check for changes | ||
id: git-check | ||
run: | | ||
git diff --exit-code README.md || echo "modified=true" >> $GITHUB_OUTPUT | ||
- name: Commit changes | ||
if: steps.git-check.outputs.modified == 'true' | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git add README.md | ||
git commit -m "Update commit status table" | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
# 残酷共学模版 | ||
|
||
> 本文档为创建残酷共学的通用模版 - 中文版,请根据模版结构来进行你的残酷共学的内容填充 | ||
# {本期残酷共学标题} | ||
|
||
## 什么是残酷共学(Intensive Co-learning)? | ||
|
||
残酷共学是由 [Bruce Xu](https://twitter.com/brucexu_eth) 首创的一种学习模式,目前由 [LXDAO](https://lxdao.io/) 组织并运营残酷共学品牌。 | ||
共学有很多种,「残酷共学」与之不同的是「残酷」: | ||
|
||
- 你必须每天围绕某个「共学主题」进行学习,每周只有两次请假机会,通常每天至少需要花费半个小时(最好一个小时)来学习。 | ||
- 你必须提交你的学习证明(按照共学内容设计)到这个「仓库」来证明你今天学习了。 | ||
- 如果你没有完成上面两点,你会立刻被踢掉并且标记为 ❌ 失败。 | ||
- 每期残酷共学以 4 周为一个周期,第一周为共学启动报名和熟悉共学规则,第二周到第四周将正式启动共学,为期 21 天,中途不得加入。 | ||
- 共学方向包括不限于:英语、以太坊、Web3 技术、DAO、加密思潮等,自由自主发起。共学的过程包括且不限于:观看视频、阅读书籍与文章、项目实战等。 | ||
|
||
报名方式是完全基于 GitHub 的流程,通过提交 PR 进行申请,合并 PR 之后拥有更新权限。如果你不熟悉 GitHub 和 Git 的操作,请先自行学习。通常还会有一个小型的 Telegram 交流群方便交流。 | ||
|
||
关于更多「残酷共学」的介绍请参见:https://forum.lxdao.io/t/topic/1654 | ||
|
||
关于更多正在发生的残酷共学请参见:https://intensivecolearn.ing/ | ||
|
||
如果你有任何有关残酷共学的疑问或者想法,请到 [残酷共学 Telegram 群](https://t.me/LXDAO/6215) 联系我们。 | ||
|
||
## {本期残酷共学名字}介绍 | ||
|
||
请写清楚本期残酷共学: | ||
|
||
- 举办的原因 | ||
- 谁/哪个组织发起的,以及合作方 | ||
- 一共几期 | ||
- 共学形式:自主学习、定期答疑、线上课程 、线下 Meetup (请自由组合或新增新的共学方式) | ||
- 本次共学目标或产出 | ||
- 适合人群 | ||
- 负责人、助教、导师的简单介绍以及联系方式 | ||
|
||
## 共学内容 | ||
|
||
请写清楚共学内容的链接以及使用方法,如果欢迎新增共学内容,也请说明一下,但请负责人保证共学的内容准确、质量、数量、符合本次共学难度。 | ||
|
||
如果有提供的具体的课程学习计划,也请在此说明。 | ||
|
||
## 共学时间 | ||
|
||
- 报名截止时间:(请写明时区) | ||
- 本期共学开始时间:(请写明时区) | ||
- 本期共学持续时间:21 天(我们默认为 21 天,21 天为养成一个新习惯的周期,可根据自己的内容和课程来制定,但不易过长或过短) | ||
|
||
## 共学规则 | ||
|
||
(以下内容为 LXDAO 共学活动默认规则,你可以根据自己共学的情况进行修改,请注意我们有自动化脚本进行打卡记录的更新,请确保如果修改规则要将脚本规则一并修改) | ||
|
||
- 报名规则:请在报名截止时间前进行报名,共学一旦开始后,不得中途加入 | ||
- 打卡规则:建议你每天学习 30 ~ 60 分钟,并将学习笔记提交,我们会自动更新你的打卡状态,每周有两次请假的机会,超过后状态变为 ❌,视为本次共学失败 | ||
- 激励规则:(如果有具体的激励方式请写明)(没有激励方案默认文案参考:通过本次共学学到的知识,就是你给自己最好的激励!) | ||
- 考核规则:(如果有具体的考核方式请写明,没有就不写) | ||
|
||
## 如何报名和打卡? | ||
|
||
因为残酷共学的报名和打卡是基于 GitHub 进行开展的,如果你是非开发者或者对 git 操作不熟悉,请先阅读此文档:[残酷共学 GitHub 新手教程](https://www.notion.so/lxdao/GitHub-53fca5ba49bb40c69e4e40e69f58f416) | ||
|
||
- 报名: | ||
|
||
- Step01:Fork 本仓库。 | ||
- Step02:复制 Template.md 创建你的个人笔记文件,并根据文档指引填写你的信息,并将文件重命名为你的名字:YourName.md。 | ||
- Step03:创建一个 PR 到当前仓库,本残酷共学助教会对你的 PR 进行 review,review 通过后,你的 PR 会被 merge 到 main 分支,这个时候你会收到邀请加入这个仓库 contribution 的邮件,接受邀请后,你会自动获得 main 分支的 push 权限。 | ||
- Step04:完成以上三个步骤,恭喜你报名成功,后续就可以将你的学习记录直接 push 到 main 分支进行更新。 | ||
- 请加入 xxx 群组保持交流:(请添加你创建的群组链接)。加入群组后请在群里报到一下方便助教记录。 | ||
|
||
- 打卡: | ||
- 报名成功后,你将拥有 main 分支的 push 权限,你需要将每天学习笔记按日期更新到你的 YourName.md 文档中,提交更新后,我们会自动更新你的打卡状态到下面的打卡记录表。 | ||
- 如果你不在 UTC+8 时区,需要添加时区 code 到你的 YourName.md 文件的开始,错误的时区设置可能会使自动化打卡脚本错误计算打卡时间,具体请参考:https://github.com/IntensiveCoLearning/template/blob/main/Template.md?plain=1#L1 | ||
- 当你提交笔记时,请确保以下几点,否则打卡可能会失败: | ||
- 在 YourName.md 文档,请将笔记内容放到以下代码块中,且 `<!-- Content_START -->` 和 `<!-- Content_END -->` 不能删除: | ||
``` | ||
<!-- Content_START --> | ||
### 日期 | ||
笔记内容 | ||
<!-- Content_END --> | ||
``` | ||
- 日期格式为 `### 2024.07.11`,请不要随意更改 | ||
## {本期残酷共学名字}打卡记录表 | ||
✅ = Done ⭕️ = Missed ❌ = Failed | ||
<!-- START_COMMIT_TABLE --> | ||
| Name | 6.24 | 6.25 | 6.26 | 6.27 | 6.28 | 6.29 | 6.30 | 7.01 | 7.02 | 7.03 | 7.04 | 7.05 | 7.06 | 7.07 | 7.08 | 7.09 | 7.10 | 7.11 | 7.12 | 7.13 | 7.14 | | ||
| --------------- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | | ||
| | | | | | | | | | | | | | | | | | | | | | | | ||
| | | | | | | | | | | | | | | | | | | | | | | | ||
| | | | | | | | | | | | | | | | | | | | | | | | ||
| | | | | | | | | | | | | | | | | | | | | | | | ||
| | | | | | | | | | | | | | | | | | | | | | | | ||
| | | | | | | | | | | | | | | | | | | | | | | | ||
| | | | | | | | | | | | | | | | | | | | | | | | ||
| | | | | | | | | | | | | | | | | | | | | | | | ||
| | | | | | | | | | | | | | | | | | | | | | | | ||
| | | | | | | | | | | | | | | | | | | | | | | | ||
| | | | | | | | | | | | | | | | | | | | | | | | ||
| | | | | | | | | | | | | | | | | | | | | | | | ||
| | | | | | | | | | | | | | | | | | | | | | | | ||
| | | | | | | | | | | | | | | | | | | | | | | | ||
<!-- END_COMMIT_TABLE --> | ||
<!-- STATISTICALDATA_START --> | ||
<!-- STATISTICALDATA_END --> | ||
> 如果你是此次共学发起人,请进行以下操作进行自动化发放权限的设置,完成后请将这一部分内容从你的仓库中删掉。 | ||
### 为您的组织 【残酷共学营】 创建具有邀请协作者权限的个人访问令牌 | ||
要创建具有邀请协作者权限的个人访问令牌,请按照以下步骤操作: | ||
1. 导航到您的个人设置: 转到 https://github.com/settings/profile 并登录您的 GitHub 帐户。 | ||
2. 访问个人访问令牌页面: 在左侧菜单中,单击 “开发者设置”,然后选择 “个人访问令牌”。 | ||
3. 创建新令牌: 点击 “生成新令牌” 按钮。选择 classic 的 | ||
4. 命名您的令牌: 在 “令牌名称” 字段中输入一个描述性名称,例如 `invite-collaborators`。 | ||
5. 选择适当的范围: 在 “范围” 部分,选择授予您的令牌所需的权限。对于邀请协作者,您需要授予以下范围: | ||
- `repo:invite`:允许您的令牌创建存储库邀请。最好是给这个令牌赋予 repo 总权限 | ||
- `admin:org` 权限的用户才能创建具有邀请协作者权限的个人访问令牌。 | ||
6. 将令牌值添加到存储库 secret: 按照上述步骤将您的个人访问令牌值添加到您的存储库 secret 中,并将名称设置为 `PAT_WITH_INVITE_PERMISSIONS`。 | ||
![image](https://github.com/user-attachments/assets/d7c06540-9076-4557-b911-e5e484a742bb) | ||
### 配置共学信息配置变量 | ||
1. 配置这四个仓库变量(Repository variables),注意不要添加**换行**,**空格**符号 | ||
| Field Name | Value | Comments | | ||
| ----------- | ------------------------- | ------------------------------- | | ||
| START_DATE | 2024-06-24T00:00:00+00:00 | Start time | | ||
| END_DATE | 2024-07-06T23:59:59+00:00 | End time | | ||
| FIELD_NAME | Name | Field name in the readme | | ||
| FILE_SUFFIX | .md | Shared learning activity number | | ||
![image](https://github.com/user-attachments/assets/d5b6f504-9eea-4215-9848-056fc33f00f8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
timezone: Pacific/Auckland | ||
--- | ||
|
||
> 请在上边的 timezone 添加你的当地时区,这会有助于你的打卡状态的自动化更新,如果没有添加,默认为北京时间 UTC+8 时区 | ||
> 时区请参考以下列表,请移除 # 以后的内容 | ||
timezone: Pacific/Honolulu # 夏威夷-阿留申标准时间 (UTC-10) | ||
|
||
timezone: America/Anchorage # 阿拉斯加标准时间 (UTC-9) | ||
|
||
timezone: America/Los_Angeles # 太平洋标准时间 (UTC-8) | ||
|
||
timezone: America/Denver # 山地标准时间 (UTC-7) | ||
|
||
timezone: America/Chicago # 中部标准时间 (UTC-6) | ||
|
||
timezone: America/New_York # 东部标准时间 (UTC-5) | ||
|
||
timezone: America/Halifax # 大西洋标准时间 (UTC-4) | ||
|
||
timezone: America/St_Johns # 纽芬兰标准时间 (UTC-3:30) | ||
|
||
timezone: America/Sao_Paulo # 巴西利亚时间 (UTC-3) | ||
|
||
timezone: Atlantic/Azores # 亚速尔群岛时间 (UTC-1) | ||
|
||
timezone: Europe/London # 格林威治标准时间 (UTC+0) | ||
|
||
timezone: Europe/Berlin # 中欧标准时间 (UTC+1) | ||
|
||
timezone: Europe/Helsinki # 东欧标准时间 (UTC+2) | ||
|
||
timezone: Europe/Moscow # 莫斯科标准时间 (UTC+3) | ||
|
||
timezone: Asia/Dubai # 海湾标准时间 (UTC+4) | ||
|
||
timezone: Asia/Kolkata # 印度标准时间 (UTC+5:30) | ||
|
||
timezone: Asia/Dhaka # 孟加拉国标准时间 (UTC+6) | ||
|
||
timezone: Asia/Bangkok # 中南半岛时间 (UTC+7) | ||
|
||
timezone: Asia/Shanghai # 中国标准时间 (UTC+8) | ||
|
||
timezone: Asia/Tokyo # 日本标准时间 (UTC+9) | ||
|
||
timezone: Australia/Sydney # 澳大利亚东部标准时间 (UTC+10) | ||
|
||
timezone: Pacific/Auckland # 新西兰标准时间 (UTC+12) | ||
|
||
--- | ||
|
||
# {你的名字} | ||
|
||
1. 自我介绍 | ||
2. 你认为你会完成本次残酷学习吗? | ||
|
||
## Notes | ||
|
||
<!-- Content_START --> | ||
|
||
### 2024.07.11 | ||
|
||
笔记内容 | ||
|
||
### 2024.07.12 | ||
|
||
<!-- Content_END --> |
Oops, something went wrong.