Github常绿养号

先准备:登录好并打开github首页

第一步:点击 New repository

post image

第二步:输入项目名称(随意),勾选Add a README file,最后点击Create repository

post image

第三步:点击Actions

post image

第四步:

post image

第五步:在如下框中输入自动执行信息

post image

执行信息如下,设置好点击右上角的 Commit changes... 即可完成!如需修改执行频率可修改0 */6 * * *为其它,本例为6小时提交一次代码。


name: main

on:
  push:
    branches:
      - main
  schedule:
    - cron: "0 */6 * * *"
permissions:
  contents: write
jobs:
  autogreen:
    runs-on: ubuntu-latest
    steps:
      - name: Clone repository
        uses: actions/checkout@v2

      - name: stick
        run: |
          date > date.txt
          git config --local user.name "自己的github用户名(重要)"
          git config --local user.email "自己的github邮箱(重要)"
          git add date.txt
          git commit --allow-empty -m "updated txt"
          git push