-
Notifications
You must be signed in to change notification settings - Fork 17
60 lines (52 loc) · 1.85 KB
/
scraper.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
58
59
60
name: Scrape Data
on:
schedule:
- cron: "0 1 * * *" # 6:30am IST
workflow_dispatch:
jobs:
fetch-data:
name: Scrape data from GitHub and Slack
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4 # This pulls the caller workflow's repo (eg: coronasafe/leaderboard-data)
with:
token: ${{ secrets.GIT_ACCESS_TOKEN }}
- uses: actions/checkout@v4
with:
repository: coronasafe/leaderboard
path: ./leaderboard
sparse-checkout: |
scraper
scripts
- name: setup python
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: pip install -r scraper/requirements.txt
- name: Scrape GitHub data
uses: nick-fields/retry@v2
with:
timeout_minutes: 10
max_attempts: 3
command: python scraper/src/github.py ${{ github.repository_owner }} data/github -l DEBUG
on_retry_command: git checkout .
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Scrape EOD updates from Slack Channel
if: ${{ env.SLACK_API_TOKEN && env.SLACK_CHANNEL }}
run: python scraper/src/slack.py --lookback_days=2
env:
SLACK_API_TOKEN: ${{ secrets.SLACK_API_TOKEN }}
SLACK_CHANNEL: ${{ inputs.slack-eod-channel }}
- name: Generate markdown files for new contributors
run: node scripts/generateNewContributors.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Commit changes
run: |
git config user.name github-actions
git config user.email [email protected]
git add data contributors
git commit -m "🌍 Update JSON - $(date -d '+5 hours +30 minutes' +'%d %b %Y | %I:%M %p')"
git push