GitHub ActionsはPublicであればずっと動いてくれる
そのうち制限かかりそうな気もしますが、現時点では無料です。
とはいえ止まってしまう時
容量で止まった時があった
Artifactとlogの保存期限を短くしておけば今の所僕が使う範疇だと問題なく動いてくれます。
キャッシュ問題
キャッシュで容量がいっぱいになるのは無いかもですが、こちらを利用して削除できました。
更新がずっと無い場合 60日
更新がずっと無い場合も止まってしまいます。確か60日です。
Process completed with exit code 128.
というエラーが出て止まっていました。
いつからか設定が必要になっていた模様です。前は権限付けいらなかったような...?
参考: https://ayousanz.hatenadiary.jp/entry/GitHub_Actions%E3%81%8B%E3%82%89push%E3%81%99%E3%82%8B%E9%9A%9B%E3%81%AB%E6%A8%A9%E9%99%90%E3%81%A7%E3%82%A8%E3%83%A9%E3%83%BC%E3%81%8C%E5%87%BA%E3%81%9F%E5%A0%B4%E5%90%88%E3%81%AB%E7%A2%BA%E8%AA%8D%E3%81%99
現状の.github/workflows/node.js.yml
name: 定期実行+GitPushごとに実行
on:
push:
branches: [ "main" ]
schedule:
- cron: '0 12,23 * * *'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [21.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
# キャッシュ
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-
# インストール
- name: npm install command
run: npm install
# 実際のコマンド
- name: main action...
run: >
NOTION_TOKEN=${{secrets.NOTION_TOKEN}}
npm run main
- name: Log action...
run: >
npm run log
- name: git commit & push
run: |
git config core.filemode false
if ! git diff --exit-code --quiet
then
git add --update
git config user.name github-actions
git config user.email action@github.com
git commit -m "Commit by github-actions"
git push https://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git HEAD:${{github.ref}}
fi
VS CodeがCron読み上げてくれるの地味に嬉しい
いつからか読み上げてくれるように