Update and Commit #229
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
name: Update and Commit | |
on: | |
schedule: | |
- cron: '0 0 * * *' # 毎日0時に実行 | |
push: | |
branches: | |
- main # mainブランチにプッシュされたときに実行 | |
workflow_dispatch: # 手動での実行も許可 | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
ref: main # メインブランチをチェックアウト | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18' | |
- name: Install dependencies | |
run: | | |
npm install -g pnpm | |
pnpm i | |
- name: Run update script | |
run: node update.js | |
- name: Commit changes | |
run: | | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git add -A | |
git commit -m "Update results from update.js" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push changes | |
uses: ad-m/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: main # プッシュ先のブランチを指定 |