Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ikunycj authored Jan 4, 2025
1 parent 19dba35 commit 25546f2
Showing 1 changed file with 3 additions and 42 deletions.
45 changes: 3 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,11 @@
- 根据随机概率控制提交(0-6 的概率),如果需要提交,则随机生成 1-3 个空提交(empty commit),并将其推送到 GitHub 仓库。
- 通过定时提交保持仓库的活跃度,让贡献图(GitHub Contributions Graph)不断更新。

## github工作流代码
```bash
name: Sang
on:

workflow_dispatch:

push:
branches:
- main
schedule:
- cron: "0 0 * * *" # 每天的 0:00 执行

jobs:
autogreen:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Setup random commit script
run: |
echo '#!/bin/bash' > random_commit.sh
echo 'RANDOM_NUM=$((0 + RANDOM % 3))' >> random_commit.sh
echo 'for i in $(seq 1 $RANDOM_NUM); do' >> random_commit.sh
echo ' git commit --allow-empty -m "Sang Meow"' >> random_commit.sh
echo 'done' >> random_commit.sh
chmod +x random_commit.sh

- name: Auto commit with random number
run: |
git config --local user.email "此处填写你的email"
git config --local user.name "此处填写你的用户名"
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git pull --rebase
./random_commit.sh
git push
```

## 使用方法
1. 创建个公开仓库,随便填一点屎
1. 把我的仓库fork到你自己的github项目,随便取个名字
2. 配置操作权限![4b77e3c90aadc4e545d58c7446d63936](https://github.com/user-attachments/assets/423feb69-9ac7-49d6-adec-ee8b3d031c55)
3. 配置读取和写入权限![4b77e3c90aadc4e545d58c7446d63936](https://github.com/user-attachments/assets/6c7ec8c2-b982-47e3-adab-c7b57ce46eca)
4. **github工作流代码**导入到github Actions中,提交
5. 测试是否成功
4. 配置个性化需求(可以省略),前往.github/workflows/main.yml配置 ![11](./public/QQ_1735964816192.png)
5. 提交一次修改,看看是否成功


0 comments on commit 25546f2

Please sign in to comment.