-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (48 loc) · 1.66 KB
/
update.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: Update
on:
workflow_dispatch:
inputs:
date:
schedule:
- cron: '1 1 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Init - Vars
id: initvars
run: |
echo "current_date=$(if [ -z "$SELECTED_DATE" ]; then date -u +%Y-%m-%d; else echo $SELECTED_DATE; fi)" >> $GITHUB_OUTPUT
env:
SELECTED_DATE: ${{ inputs.date }}
- name: Init - Configure Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "Update Bot"
- name: Download full data
run: |
mkdir build
cd build
curl -fL https://raw.githubusercontent.com/statinsight/PopularGHRepos/master/data/${{ steps.initvars.outputs.current_date }}.sqlite -o database.sqlite
- name: Init Tools
run: |
sudo apt-get install -y sqlite3
- name: Convert database to thin csv
run: |
echo "SELECT StargazersCount AS Stars, OwnerLoginName AS Owner, Name AS Repo" > query.sql
echo "FROM RepositoryInfos" >> query.sql
echo "ORDER BY StargazersCount DESC;" >> query.sql
sqlite3 database.sqlite -header -csv < query.sql > db.csv
working-directory: build
- name: Transfer data into git repo
run: |
mkdir -p data
mv build/db.csv data/${{ steps.initvars.outputs.current_date }}.csv
- name: Clean
run: rm -r build
- name: Commit and Push
run: |
git add -A
git commit -m "Added files of ${{ steps.initvars.outputs.current_date }}"
git push origin