-
Notifications
You must be signed in to change notification settings - Fork 0
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 9c5c54e
Showing
4 changed files
with
104 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,28 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
# schedule: | ||
# - cron: "0 0 * * *" | ||
|
||
jobs: | ||
autogreen: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- name: Clone repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Auto green | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "迷渡" | ||
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | ||
git pull --rebase | ||
git commit --allow-empty -m "a commit a day keeps your girlfriend away" | ||
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,4 @@ | ||
*.log | ||
.DS_Store | ||
*bak | ||
.history |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 everyone. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,51 @@ | ||
# auto-green | ||
|
||
[](https://github.com/justjavac/auto-green/actions) | ||
|
||
自动保持 GitHub 提交状态常绿。 | ||
|
||
> a commit a day keeps your girlfriend away. | ||
## 原理 | ||
|
||
使用 GitHub Actions 的定时任务功能,每隔一段时间自动执行 `git commit`,提交信息为 "a commit a day keeps your girlfriend away",灵感来自知乎问题[在 GitHub 上保持 365 天全绿是怎样一种体验?](https://www.zhihu.com/question/34043434/answer/57826281)下某匿名用户的回答: | ||
|
||
> 曾经保持了 200 多天全绿,但是冷落了女朋友,一直绿到现在。 | ||
有关 Github Action 的原理,可查看官方文档 [Github Action 简介](https://docs.github.com/cn/actions/learn-github-actions/introduction-to-github-actions) | ||
|
||
## 使用 | ||
|
||
- 点右上角 **Use this template** 按钮复制本 GitHub 仓库,**:warning: 千万不要 Fork,因为 fork 项目的动态并不会让你变绿 :warning:** | ||
- 修改 [ci.yml 文件的第 7、8 行](https://github.com/justjavac/auto-green/blob/master/.github/workflows/ci.yml#L7-L8) 去掉前面的 `#` 号 | ||
- 修改 [ci.yml 文件的第 23、24 行](https://github.com/justjavac/auto-green/blob/master/.github/workflows/ci.yml#L19-L20) 为自己的 GitHub 账号和昵称 | ||
- (可选) 你可以通过修改 [ci.yml 文件的第 8 行](https://github.com/justjavac/auto-green/blob/master/.github/workflows/ci.yml#L8)来调整频率 | ||
|
||
计划任务语法有 5 个字段,中间用空格分隔,每个字段代表一个时间单位。 | ||
|
||
```plain | ||
┌───────────── 分钟 (0 - 59) | ||
│ ┌───────────── 小时 (0 - 23) | ||
│ │ ┌───────────── 日 (1 - 31) | ||
│ │ │ ┌───────────── 月 (1 - 12 或 JAN-DEC) | ||
│ │ │ │ ┌───────────── 星期 (0 - 6 或 SUN-SAT) | ||
│ │ │ │ │ | ||
│ │ │ │ │ | ||
│ │ │ │ │ | ||
* * * * * | ||
``` | ||
|
||
每个时间字段的含义: | ||
|
||
|符号 | 描述 | 举例 | | ||
| ----- | -----------| -------------------------------------------| | ||
| `*` | 任意值 | `* * * * *` 每天每小时每分钟 | | ||
| `,` | 值分隔符 | `1,3,4,7 * * * *` 每小时的 1 3 4 7 分钟 | | ||
| `-` | 范围 | `1-6 * * * *` 每小时的 1-6 分钟 | | ||
| `/` | 每 | `*/15 * * * *` 每隔 15 分钟 | | ||
|
||
**注**:由于 GitHub Actions 的限制,如果设置为 `* * * * *` 实际的执行频率为每 5 分执行一次。 | ||
|
||
## License | ||
|
||
[auto-green](https://github.com/justjavac/auto-green) is released under the MIT License. See the bundled [LICENSE](./LICENSE) file for details. |