Fetch and Store GitHub Data for Organization #76
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: Fetch and Store GitHub Data for Organization | |
on: | |
schedule: | |
- cron: "0 0 * * *" # Run daily at midnight UTC | |
workflow_dispatch: # Allows manual triggering of the workflow | |
jobs: | |
fetch-and-store: | |
runs-on: self-hosted | |
steps: | |
# 1. Checkout the repository | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
# 2. Set up Python | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
# 3. Install dependencies | |
- name: Install Python Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests mysql-connector-python | |
# 4. Run the Python script to fetch and store data | |
- name: Fetch and Store Data in MySQL | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB }} # Use the PAT instead of the default GITHUB_TOKEN | |
ORG_NAME: ni | |
REQUIRED_TOPIC: ni-open-source | |
MYSQL_HOST: 127.0.0.1 | |
MYSQL_USER: root | |
MYSQL_PASSWORD: ${{ secrets.MYSQL_PASSWORD }} | |
MYSQL_DATABASE: ni_open_source_github_data | |
run: python .github/scripts/fetch_store_org_data_conditional.py |