Scheduled #883
This file contains hidden or 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: Scheduled | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| # 3:31分に実行 3(JST)-9+24=18(UTC) | |
| - cron: '31 18 * * *' | |
| jobs: | |
| build: | |
| name: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: denoland/setup-deno@v1 | |
| with: | |
| deno-version: v1.x | |
| - name: make | |
| env: | |
| SECRET: ${{ secrets.secret }} | |
| run: | | |
| deno run -A -r update.js $SECRET | |
| - name: commit and push | |
| run: | | |
| git config --global user.email "workflow@example.com" | |
| git config --global user.name "workflow user" | |
| git add . | |
| git commit -m 'update data' && git push ${REPO} HEAD:${{github.event.pull_request.head.ref}} || true | |
| git push | |
| - name: Notify Slack on failure | |
| if: failure() | |
| run: | | |
| curl --fail -X POST -H 'Content-type: application/json' \ | |
| --data '{ | |
| "attachments": [ | |
| { | |
| "color": "#E01E5A", | |
| "title": "【恐竜博物館】データ更新に失敗しました。", | |
| "title_link": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", | |
| "fields": [ | |
| { | |
| "title": "ワークフロー", | |
| "value": "${{ github.workflow }}", | |
| "short": true | |
| }, | |
| { | |
| "title": "ジョブ", | |
| "value": "${{ github.job }}", | |
| "short": true | |
| } | |
| ], | |
| "text": "GitHub Actionsの実行中にエラーが発生しました。至急ログを確認してください。" | |
| } | |
| ] | |
| }' \ | |
| ${{ secrets.SLACK_WEBHOOK }} |