Update #1615
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: 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 |