mirror of
https://github.com/developersIndia/deviras.git
synced 2024-11-23 05:33:12 +05:30
minor changes
This commit is contained in:
parent
bc372531f2
commit
1e4f32431c
@ -31,5 +31,5 @@ jobs:
|
|||||||
GIST_ID: ${{ secrets.GIST_ID }}
|
GIST_ID: ${{ secrets.GIST_ID }}
|
||||||
GIST_TOKEN: ${{ secrets.GIST_TOKEN }}
|
GIST_TOKEN: ${{ secrets.GIST_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
cd community-threads-grabber
|
cd community-threads
|
||||||
python main.py
|
python main.py
|
||||||
|
@ -1,14 +1,9 @@
|
|||||||
name: r/developersIndia titles updater
|
name: r/developersIndia Titles Updater
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
# At 19:30 on every 2nd day-of-week.”
|
# At 19:30 on every 2nd day-of-week.”
|
||||||
- cron: '30 19 * * */2'
|
- cron: '30 19 * * */2'
|
||||||
# workflow_dispatch:
|
|
||||||
# push:
|
|
||||||
# branches: [ "main" ]
|
|
||||||
# pull_request:
|
|
||||||
# branches: [ "main" ]
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
@ -17,9 +17,9 @@ Used for changing the text below total members & live members count in a subredd
|
|||||||
|
|
||||||
Used for updating the Advent of Code leaderboard in the [post](https://www.reddit.com/r/developersIndia/comments/1889ar3/advent_of_code_rdevelopersindia_leaderboard_year/).
|
Used for updating the Advent of Code leaderboard in the [post](https://www.reddit.com/r/developersIndia/comments/1889ar3/advent_of_code_rdevelopersindia_leaderboard_year/).
|
||||||
|
|
||||||
### [community-threads-grabber](https://github.com/developersIndia/deviras/tree/main/community-threads-grabber)
|
### [community-threads](https://github.com/developersIndia/deviras/tree/main/community-threads)
|
||||||
|
|
||||||
Used for grabbing the posts from [community threads collection](https://www.reddit.com/r/developersIndia/collection/958aef35-f9cb-414d-ab33-08bc639e47de/) and updating the [wiki](https://www.reddit.com/r/developersIndia/wiki/community-threads/).
|
Used for grabbing the posts from [community threads collection](https://www.reddit.com/r/developersIndia/collection/958aef35-f9cb-414d-ab33-08bc639e47de/) and adding it to the [wiki](https://www.reddit.com/r/developersIndia/wiki/community-threads/).
|
||||||
|
|
||||||
### [job_thread](https://github.com/developersIndia/deviras/blob/job_thread)
|
### [job_thread](https://github.com/developersIndia/deviras/blob/job_thread)
|
||||||
|
|
||||||
|
@ -28,7 +28,9 @@ def format_leaderboard(data, num_players=100):
|
|||||||
|
|
||||||
# Include only the top players
|
# Include only the top players
|
||||||
for i, member_data in enumerate(sorted_members[:num_players]):
|
for i, member_data in enumerate(sorted_members[:num_players]):
|
||||||
leaderboard_stats += f"| {i + 1} | {member_data['name']} | {member_data['stars']} | {member_data['local_score']} |\n"
|
# check for non-zero local_score
|
||||||
|
if member_data['local_score'] > 0:
|
||||||
|
leaderboard_stats += f"| {i + 1} | {member_data['name']} | {member_data['stars']} | {member_data['local_score']} |\n"
|
||||||
|
|
||||||
leaderboard_stats += f"\n[Advent of Code Leaderboard](https://adventofcode.com/2023/leaderboard/private/view/{aoc_leaderboard_code})\n"
|
leaderboard_stats += f"\n[Advent of Code Leaderboard](https://adventofcode.com/2023/leaderboard/private/view/{aoc_leaderboard_code})\n"
|
||||||
leaderboard_stats += f"\nUpdated every 24 hours"
|
leaderboard_stats += f"\nUpdated every 24 hours"
|
||||||
|
@ -61,14 +61,14 @@ def update_wiki(reddit, wikipage, posts):
|
|||||||
|
|
||||||
wiki_header = """# A collection of must read discussions started by community members"""
|
wiki_header = """# A collection of must read discussions started by community members"""
|
||||||
content = wiki_header + "\n\n"
|
content = wiki_header + "\n\n"
|
||||||
content += f"This collection contains a list of `{total_posts}` handpicked posts across `{total_years}` years.\n\n"
|
content += f"A handpicked collection of **{total_posts}** quality threads across {total_years} years.\n\n"
|
||||||
|
|
||||||
for year in sorted(posts_by_year.keys(), reverse=True):
|
for year in sorted(posts_by_year.keys(), reverse=True):
|
||||||
content += f"## {year}\n\n"
|
content += f"## {year}\n\n"
|
||||||
# Add the posts for this year
|
# Add the posts for this year
|
||||||
for post in posts_by_year[year]:
|
for post in posts_by_year[year]:
|
||||||
formatted_date = datetime.strptime(post['created_at'], '%Y-%m-%dT%H:%M:%S').strftime('%d-%m-%Y')
|
formatted_date = datetime.strptime(post['created_at'], '%Y-%m-%dT%H:%M:%S').strftime('%d-%m-%Y')
|
||||||
content += f"- `{formatted_date}` [{post['title']}]({post['url']})\n\n"
|
content += f"- `{formatted_date}` [`{post['title']}`]({post['url']})\n\n"
|
||||||
|
|
||||||
# given a wiki link, update the wiki page with new markdown
|
# given a wiki link, update the wiki page with new markdown
|
||||||
wikipage = reddit.subreddit(sub).wiki[wikipage]
|
wikipage = reddit.subreddit(sub).wiki[wikipage]
|
Loading…
Reference in New Issue
Block a user