Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pulling nightly into master #113

Merged
merged 1 commit into from
Aug 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/update-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
working-directory: gh-pages
run: |
python ../update.py \
--discord_invite ${{ secrets.DISCORD_INVITE }} \
--facebook_group_id ${{ secrets.FACEBOOK_GROUP_ID }} \
--facebook_page_id ${{ secrets.FACEBOOK_PAGE_ID }} \
--facebook_token ${{ secrets.FACEBOOK_ACCESS_TOKEN }} \
Expand Down
18 changes: 17 additions & 1 deletion update.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,19 @@ def update_aur():
write_json_files(file_path=file_path, data=data)


def update_discord():
"""
Cache and update data from Discord API.
"""
discord_url = f'https://discordapp.com/api/invites/{args.discord_invite}?with_counts=true'

response = s.get(url=discord_url)
data = response.json()

file_path = os.path.join('discord', 'invite')
write_json_files(file_path=file_path, data=data)


def update_fb():
"""
Get number of Facebook page likes and group members.
Expand Down Expand Up @@ -243,6 +256,8 @@ def missing_arg():
if __name__ == '__main__':
# setup arguments using argparse
parser = argparse.ArgumentParser(description="Update github pages.")
parser.add_argument('--discord_invite', type=str, required=False, default=os.getenv('DISCORD_INVITE'),
help='Discord invite code.')
parser.add_argument('--facebook_group_id', type=str, required=False, default=os.getenv('FACEBOOK_GROUP_ID'),
help='Facebook group ID.')
parser.add_argument('--facebook_page_id', type=str, required=False, default=os.getenv('FACEBOOK_PAGE_ID'),
Expand All @@ -264,11 +279,12 @@ def missing_arg():
args = parser.parse_args()
args.indent = 4 if args.indent_json else None

if not args.facebook_group_id or not args.facebook_page_id or not args.facebook_token \
if not args.discord_invite or not args.facebook_group_id or not args.facebook_page_id or not args.facebook_token \
or not args.github_repository_owner or not args.github_auth_token or not args.readthedocs_token:
missing_arg()

update_aur()
update_discord()
update_fb()
update_github()
update_patreon()
Expand Down
Loading