From 8e603fd5f9f06e44f1bd7090a73218e8f91e2af8 Mon Sep 17 00:00:00 2001 From: Jokob-sk Date: Sun, 28 Jan 2024 22:37:44 +1100 Subject: [PATCH] Sponsorship auto-generate v0.1.40 --- .github/workflows/update_sponsors.yml | 18 ------------------ .github/workflows/update_sponsors_table.yml | 6 ++---- update_sponsors.py | 7 ++++--- 3 files changed, 6 insertions(+), 25 deletions(-) delete mode 100755 .github/workflows/update_sponsors.yml diff --git a/.github/workflows/update_sponsors.yml b/.github/workflows/update_sponsors.yml deleted file mode 100755 index db36b227..00000000 --- a/.github/workflows/update_sponsors.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Update Sponsors - -on: - schedule: - - cron: '25 11 * * *' # Set your preferred schedule (UTC) - -jobs: - update-readme: - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Update Sponsors - run: | - GH_TOKEN=${{ secrets.GITHUB_TOKEN }} - gh run workflow_dispatch -R $GITHUB_REPOSITORY update_sponsors_table.yml diff --git a/.github/workflows/update_sponsors_table.yml b/.github/workflows/update_sponsors_table.yml index e8adc05f..d5516d24 100755 --- a/.github/workflows/update_sponsors_table.yml +++ b/.github/workflows/update_sponsors_table.yml @@ -1,10 +1,8 @@ name: Update Sponsors Table on: - workflow_run: - workflows: ["Update Sponsors"] - types: - - completed + schedule: + - cron: '40 11 * * *' # Set your preferred schedule (UTC) jobs: update-table: diff --git a/update_sponsors.py b/update_sponsors.py index 448166d5..c332b35b 100755 --- a/update_sponsors.py +++ b/update_sponsors.py @@ -72,10 +72,10 @@ def fetch_sponsors(): } # Check if the sponsorship is current or past - if privacy_level == "PUBLIC": - current_sponsors.append(sponsor) - else: + if created_at == sponsorship["createdAt"]: past_sponsors.append(sponsor) + else: + current_sponsors.append(sponsor) print("Current Sponsors:") print(current_sponsors) @@ -85,6 +85,7 @@ def fetch_sponsors(): return {"current_sponsors": current_sponsors, "past_sponsors": past_sponsors} + def generate_sponsors_table(current_sponsors, past_sponsors): current_table = "| Current Sponsors |\n|---|\n" for sponsor in current_sponsors: