From c956755e1aa90db130fbc8e3eb06cb7d26d17a5c Mon Sep 17 00:00:00 2001 From: Damyan Yordanov Date: Wed, 24 Jan 2024 13:39:39 +0100 Subject: [PATCH] Add all sources to new folder `src` (#13) * Add all sources to new folder `src` * Fix lint action * Fix config file path * Update readme with the new path --- .github/workflows/pylint.yaml | 2 +- .github/workflows/python-test-and-run.yaml | 2 +- README.md | 10 +++++++++- __init__.py => src/__init__.py | 0 auto_submit_tips.py => src/auto_submit_tips.py | 7 +++++-- creds-secret.yaml => src/config/creds-secret.yaml | 0 6 files changed, 16 insertions(+), 5 deletions(-) rename __init__.py => src/__init__.py (100%) rename auto_submit_tips.py => src/auto_submit_tips.py (96%) rename creds-secret.yaml => src/config/creds-secret.yaml (100%) diff --git a/.github/workflows/pylint.yaml b/.github/workflows/pylint.yaml index ed1b5aa..998209e 100644 --- a/.github/workflows/pylint.yaml +++ b/.github/workflows/pylint.yaml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v4 - uses: Silleellie/pylint-github-action@v2 with: - lint-path: ./ + lint-path: ./src python-version: 3.11 requirements-path: requirements.txt readme-path: README.md diff --git a/.github/workflows/python-test-and-run.yaml b/.github/workflows/python-test-and-run.yaml index a5bbbd1..274d4b2 100644 --- a/.github/workflows/python-test-and-run.yaml +++ b/.github/workflows/python-test-and-run.yaml @@ -23,4 +23,4 @@ jobs: run: pip install -r requirements.txt - name: Run kicktipp - run: ./auto_submit_tips.py -h + run: ./src/auto_submit_tips.py -h diff --git a/README.md b/README.md index 95825bb..2e3e063 100644 --- a/README.md +++ b/README.md @@ -31,5 +31,13 @@ pip install -r requirements.txt # Execution ```bash -./auto_submit_tips.py +./src/auto_submit_tips.py -h +usage: Kicktipp auto tipping [-h] [-2 | -r] + +Perform automatic kicktipp tipping for the bots + +options: + -h, --help show this help message and exit + -2 2:1 tipping + -r random tipping ``` diff --git a/__init__.py b/src/__init__.py similarity index 100% rename from __init__.py rename to src/__init__.py diff --git a/auto_submit_tips.py b/src/auto_submit_tips.py similarity index 96% rename from auto_submit_tips.py rename to src/auto_submit_tips.py index cfdd0a6..c05d97b 100755 --- a/auto_submit_tips.py +++ b/src/auto_submit_tips.py @@ -4,6 +4,7 @@ import argparse import logging import random +import os import subprocess import sys import yaml @@ -19,7 +20,7 @@ TIPPER_ID_2_1_BOT = "46952968" # 2:1 bot TIPPER_ID_7_6_BOT = "50360538" # random bot TIPP_SAISON_ID = "1670602" -CREDS_FILE = "creds-secret.yaml" +CREDS_FILE_PATH = "config/creds-secret.yaml" RANDOM_RESULTS = [] @@ -78,7 +79,9 @@ def get_creds() -> tuple[str, str]: return(string): password, if successfully decrypted, None else """ try: - result = subprocess.run(['sops', '-d', CREDS_FILE], + full_config_file_path = os.path.join(os.path.dirname(__file__), + CREDS_FILE_PATH) + result = subprocess.run(['sops', '-d', full_config_file_path], capture_output=True, check=True, text=True) diff --git a/creds-secret.yaml b/src/config/creds-secret.yaml similarity index 100% rename from creds-secret.yaml rename to src/config/creds-secret.yaml