一日一回 感謝の草生やし
リポジトリ作成
偽りの草を生やす為、適当なリポジトリを作成する。
その際 Add a README file
をチェックして、README ファイルも作成する。
以降の手順で README ファイルへの変更を自動化する。
シークレット登録
作成したリポジトリ内の Settings > Secrets and variables > Actions
New repository secret をクリックする。
-
Name
USER_NAME
- Secret GitHub のアカウント名
-
Name
USER_EMAIL
- Secret GitHub アカウントに紐づけたメールアドレス または GitHub が提供している noreply メールアドレス
上記の内容でそれぞれ登録する。
書き込み権限の付与
作成したリポジトリ内の Settings > Actions > General
Workflow permissions 内
Read repository contents and packages permissions が選択されている場合は
Read and write permissions へ変更して Save をクリックする。
秘伝の YAML
作成したリポジトリ内の Actions > set up a workflow yourself をクリックする。
.github/workflows/main.yml
name: auto grow grass
on:
workflow_dispatch:
schedule:
- cron: 0 0 * * *
jobs:
auto-grow-grass:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: auto push
run: |
echo "w" >> README.md
git config --local user.name ${{ secrets.USER_NAME }}
git config --local user.email ${{ secrets.USER_EMAIL }}
git add .
git commit -m "w"
git push -u origin main
上記をコピペ後 Commit changes... > Commit changes をクリックして反映する。
試運転
作成したリポジトリ内 Actions > Workflows 内 auto grow grass > Run workflow を
実行する。
緑のチェックマーク(成功)で草が生えていることを確認する。
以降、毎日だいたい朝十時頃に草が生える。