Daily Update #661
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: Daily Update | |
on: | |
schedule: | |
# 4:00AM every day | |
- cron: '0 19 * * *' | |
workflow_dispatch: | |
inputs: | |
commit: | |
description: Commit fetched files | |
type: boolean | |
required: false | |
default: false | |
jobs: | |
daily-update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Event check | |
run: echo ${{ github.event_name }} | |
- name: checkout | |
uses: actions/checkout@v2 | |
with: | |
ref: main | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.18' | |
- name: Build bin | |
run: go install -v github.com/otiai10/syobocal@latest | |
- name: Env check | |
run: | | |
go env; | |
which syobocal | |
- name: Run crawler | |
run: syobocal -db=./ | |
- name: File check | |
run: | | |
pwd; | |
p=$(date '+%Y/%m'); | |
ls -l ./${p}; | |
- name: Dump if workflow_dispatch | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
run: | | |
p=$(date --date='1 day ago' '+%Y/%m/%d.json'); | |
cat ./${p}; | |
- name: Commit | |
if: ${{ github.event_name == 'schedule' || inputs.commit }} | |
run: | | |
git config --global user.email [email protected] | |
git config --global user.name "Ayanel CI" | |
d=$(date '+%Y-%m-%d'); | |
git add .; | |
git commit -m "Update: ${d}"; | |
git push origin main; |