ci: create patreon list
This commit is contained in:
@@ -55,6 +55,14 @@ jobs:
|
||||
- name: Checkout Source Code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Generate Patreon List
|
||||
env:
|
||||
PATREON_KEY: ${{ secrets.PATREON_KEY }}
|
||||
run: |
|
||||
cd $GITHUB_WORKSPACE/app/dialog/about
|
||||
python3 patreon.py
|
||||
if: github.event_name == 'push'
|
||||
|
||||
- name: Configure CMake
|
||||
run: |
|
||||
mkdir build
|
||||
@@ -179,6 +187,14 @@ jobs:
|
||||
$DOWNLOAD_TOOL https://github.com/olive-editor/dependencies/releases/download/continuous/olive-dep-win32.tar.gz
|
||||
tar xzf olive-dep-win32.tar.gz
|
||||
|
||||
- name: Generate Patreon List
|
||||
env:
|
||||
PATREON_KEY: ${{ secrets.PATREON_KEY }}
|
||||
run: |
|
||||
cd $GITHUB_WORKSPACE/app/dialog/about
|
||||
python3 patreon.py
|
||||
if: github.event_name == 'push'
|
||||
|
||||
- name: Configure CMake
|
||||
shell: bash
|
||||
env:
|
||||
@@ -322,6 +338,14 @@ jobs:
|
||||
$DOWNLOAD_TOOL https://github.com/olive-editor/dependencies/releases/download/continuous/olive-dep-mac-x86_64.tar.gz
|
||||
sudo tar xzf olive-dep-mac-x86_64.tar.gz -C /
|
||||
|
||||
- name: Generate Patreon List
|
||||
env:
|
||||
PATREON_KEY: ${{ secrets.PATREON_KEY }}
|
||||
run: |
|
||||
cd $GITHUB_WORKSPACE/app/dialog/about
|
||||
python3 patreon.py
|
||||
if: github.event_name == 'push'
|
||||
|
||||
- name: Configure CMake
|
||||
shell: bash
|
||||
working-directory: ${{ runner.workspace }}/build
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import json
|
||||
import requests
|
||||
import os
|
||||
|
||||
url = 'https://www.patreon.com/api/oauth2/v2/campaigns/1478705/members?include=currently_entitled_tiers&fields%5Bmember%5D=full_name'
|
||||
name_list = ''
|
||||
|
||||
while True:
|
||||
member_data = requests.get(url, headers = {"authorization": "Bearer " + os.environ.get('PATREON_KEY')})
|
||||
member_data_decoded = json.loads(member_data.text)
|
||||
|
||||
for member in member_data_decoded["data"]:
|
||||
if len(member["relationships"]["currently_entitled_tiers"]["data"]) > 0:
|
||||
if member["relationships"]["currently_entitled_tiers"]["data"][0]["id"] == "3952333":
|
||||
if len(name_list) > 0:
|
||||
name_list += ',\n'
|
||||
name = member["attributes"]["full_name"]
|
||||
name_list += " QStringLiteral(\""
|
||||
name_list += name.translate(str.maketrans({
|
||||
"\"": "\\\"",
|
||||
"\\": "\\\\"
|
||||
}))
|
||||
name_list += "\")"
|
||||
|
||||
if "links" in member_data_decoded:
|
||||
url = member_data_decoded["links"]["next"]
|
||||
else:
|
||||
break
|
||||
|
||||
text_file = open("patreon.h", "w")
|
||||
text_file.write("#ifndef PATREON_H\n#define PATREON_H\n\n#include <QStringList>\n\nQStringList patrons = {\n%s\n};\n\n#endif // PATREON_H\n" % name_list)
|
||||
text_file.close()
|
||||
Reference in New Issue
Block a user