From b71c2cc6e03895e6f4110b9a54d941b631cbfe66 Mon Sep 17 00:00:00 2001 From: Attila Gabor Date: Tue, 4 Feb 2025 13:23:00 +0100 Subject: [PATCH] adding pyzotero GA --- .../workflows/bot_daily_posting_pyzotero.yml | 44 +++++++++++++++++++ download_state.py => download_google_file.py | 0 requirements.txt | 6 +++ 3 files changed, 50 insertions(+) create mode 100644 .github/workflows/bot_daily_posting_pyzotero.yml rename download_state.py => download_google_file.py (100%) create mode 100644 requirements.txt diff --git a/.github/workflows/bot_daily_posting_pyzotero.yml b/.github/workflows/bot_daily_posting_pyzotero.yml new file mode 100644 index 0000000..7ec455b --- /dev/null +++ b/.github/workflows/bot_daily_posting_pyzotero.yml @@ -0,0 +1,44 @@ +name: Daily Posting to Slack (Python Bot) + +on: + workflow_dispatch: + schedule: + # Run every weekday at 11:00 UTC (adjust as needed) + - cron: '00 11 * * 1-5' + +jobs: + bot_job: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + # Write the service account JSON to a file from the secret. + - name: Write Google Service Account file + run: echo "${{ secrets.GOOGLE_SERVICE_ACCOUNT_JSON }}" > service_account.json + + - name: Download state file from Google Drive + run: | + python download_google_file.py \ + --file_id "${{ secrets.STATEFILE_FILE_ID }}" \ + --output_path state.csv \ + --service_account_file service_account.json + + - name: Run the Python bot + run: | + python bot.py \ + --file_path state.csv \ + --zotero_api_key "${{ secrets.ZOTERO_API_KEY }}" \ + --zotero_library_id "${{ secrets.ZOTERO_LIBRARY_ID }}" \ + --slack_token "${{ secrets.SLACK_API_KEY }}" diff --git a/download_state.py b/download_google_file.py similarity index 100% rename from download_state.py rename to download_google_file.py diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..27f6ae8 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +pyzotero +pandas +slack_sdk +google-api-python-client +google-auth +google-auth-oauthlib