Skip to content

Commit

Permalink
ci: add vndb_id_connector
Browse files Browse the repository at this point in the history
  • Loading branch information
Tabing010102 committed Dec 3, 2024
1 parent 5048860 commit 57b2138
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 7 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/vndb_id_connector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Run vndb_id_connector

on:
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:

jobs:
ci:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Build and run docker compose containers
run: |
cd scripts/vndb_id_connector
docker compose up -d
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Run vndb_id_connector
run: |
sleep 180
cd scripts/vndb_id_connector
pip install -r requirements.txt
python main.py
- name: GitHub Commit & Push
uses: actions-js/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: "master"
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
psycopg2==2.9.9
psycopg2==2.9.10
2 changes: 1 addition & 1 deletion scripts/vndb_id_connector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

```bash
# Deploy containers
docker-compose up -d
docker compose up -d
# Run script

```
12 changes: 7 additions & 5 deletions scripts/vndb_id_connector/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# WARN: Currently ALL SHIT MOUNTAIN, proceed WITH CAUTION
import json
import sys

import psycopg2

Expand All @@ -10,11 +11,11 @@

if __name__ == "__main__":
# connect db
vndb_conn = psycopg2.connect(database='vndb', user='postgres', password='postgres', host='192.168.5.17',
port='5432')
vndb_conn = psycopg2.connect(database='vndb', user='vndb', password='vndb', host='localhost',
port='10001')
vndb_cur = vndb_conn.cursor()
bangumi_conn = psycopg2.connect(database='bangumi', user='postgres', password='postgres', host='192.168.5.17',
port='5432')
bangumi_conn = psycopg2.connect(database='bangumi', user='bangumi', password='bangumi', host='localhost',
port='10000')
bangumi_cur = bangumi_conn.cursor()

# var
Expand Down Expand Up @@ -103,5 +104,6 @@ def get_names(vid, bangumi_id=None):
"names": get_names(vid, bangumi_match)
})
json_result['entries'] = matches
with open('../../game_id_connector/2-vndb_automated.json', 'w', encoding='utf8') as f3:
saved_file_path = '../../game_id_connector/2-vndb_automated.json' if len(sys.argv) == 1 else sys.argv[1]
with open(saved_file_path, 'w', encoding='utf8') as f3:
f3.writelines(json.dumps(json_result, ensure_ascii=False, indent=2))
1 change: 1 addition & 0 deletions scripts/vndb_id_connector/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
psycopg2==2.9.10

0 comments on commit 57b2138

Please sign in to comment.