forked from otiai10/syobocal
-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (54 loc) · 1.36 KB
/
crawl-daily.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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 otiai10+ayanel-ci@gmail.com
git config --global user.name "Ayanel CI"
d=$(date '+%Y-%m-%d');
git add .;
git commit -m "Update: ${d}";
git push origin main;