diff --git a/.github/workflows/build-feeds.yml b/.github/workflows/build-feeds.yml index f850530..4bfa1fb 100644 --- a/.github/workflows/build-feeds.yml +++ b/.github/workflows/build-feeds.yml @@ -2,9 +2,15 @@ name: Build RSS feeds on: schedule: - - cron: "0 6 * * *" # Runs once per day at 06:00 UTC + - cron: "0 6 * * *" # daily at 06:00 UTC workflow_dispatch: + inputs: + verbose: + description: "Enable verbose logging" + required: false + default: "false" + type: boolean jobs: build: @@ -21,26 +27,31 @@ jobs: with: python-version: "3.14" - - name: Install dependencies + - name: Install package run: | python -m pip install --upgrade pip - pip install sparqlwrapper feedgen lxml tinydb + pip install . - - name: Set environment variables + - name: Prepare cache directory run: | echo "RESSPUBLICA_CACHE=$GITHUB_WORKSPACE/.cache" >> $GITHUB_ENV mkdir -p "$GITHUB_WORKSPACE/.cache" - name: Generate feeds run: | - python resspublica/main.py + if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ inputs.verbose }}" = "true" ]; then + echo "Running in VERBOSE mode" + resspublica --verbose + else + resspublica + fi - name: Commit and push changes run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - git add . + git add feed/ .cache/ if git diff --cached --quiet; then echo "No changes to commit" diff --git a/resspublica/main.py b/resspublica/main.py index e4c3855..de362b7 100644 --- a/resspublica/main.py +++ b/resspublica/main.py @@ -88,6 +88,7 @@ def generateFederalFeed(): results = sparql.query().convert() logger.info("Query succesfully returned. Processing the feeds.") + logger.info(f"Lenght of the return: {len(results["results"]["bindings"])}\nShould be greater or equal than 550 if the query limit wasn't overriden.") now = datetime.now(ZoneInfo("Europe/Zurich"))