A GitHub Action that automatically reports your Advent of Code progress in a table in your README

Overview

Advent README Stars

CI codecov

This action adds and maintains a stars report in your README based on your Advent of Code progress.

Example Table

2021 Results

Day Part 1 Part 2
Day 1
Day 2

Quickstart

Add this line somewhere in your README.md:

<!--- advent_readme_stars table --->

Make a note of your user ID and add your session cookie to your repo as a secret called AOC_SESSION. To see how to find these values, see those sections in the spec below.

Add this action to your repo as .github/workflows/readme-stars.yml, pasting in your user ID and the leaderboard ID to pull data from (or remove this argument to default to your own private leaderboard):

name: Update README ⭐
on:
  schedule:
    - cron: "51 */4 * * *"  # Every 4 hours
  workflow_dispatch:

jobs:
  update-readme:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/[email protected]
      - uses: k2bd/[email protected]
        with:
          userId: 1234567
          leaderboardId: 9876543
          sessionCookie: ${{ secrets.AOC_SESSION }}
      - uses: stefanzweifel/[email protected]
        with:
          commit_message: Update README stars

If you want to adjust the cron expression, please remember to schedule your jobs such that you respect the Advent of Code request of running automated requests at a rate of no more than 1 per 15 minutes.

Action Spec

userId

Required

Your Advent of Code user ID. To get this, go to your Go to settings. The user ID is displayed in the first option of the question "What would you like to be called?":

( ) (anonymous user #<your ID>)
( ) ....

sessionCookie

Required

Your Advent of Code session cookie. To get this, press F12 anywhere on the Advent of Code website to open your browser developer tools. Look in your Cookies under the Application or Storage tab, and copy out the session cookie. This should be stored as a repository secret, not pasted directly into the action or any other publicly viewable place.

leaderboardId

Optional - default userId value

Your Advent of Code leaderboard ID. To get this, go to your Go to leaderboard and press 'View'. The leaderboard ID is at the end of the URL:

https://adventofcode.com/2021/leaderboard/private/view/(leaderboard ID)

tableMarker

Optional - default <!--- advent_readme_stars table --->

This is the string that marks the table location in your README file. The action will only work if it finds this marker in your file, on its own line. You should only add it once, and then let the action do its work.

Change this value if, for example, you'd like different actions maintaining different year results. However, remember to schedule your jobs such that you respect the Advent of Code request of running automated requests at a rate of no more than 1 per 15 minutes.

starSymbol

Optional - default

The symbol that will mark completed parts in your table.

year

Optional - default is year of the most recent advent

Year to get results for. By default, it will get results for the year of the most recent advent. That is, this year if it's December, otherwise last year.

headerPrefix

Optional - default ##

Prefix for the section header added before the table. Should be some kind of Markdown header level.

readmeLocation

Optional - default README.md

Location of the README file to edit.

Like this project?

"Buy Me A Coffee"

Comments
  • Specify an (optional) private leaderboardId as input

    Specify an (optional) private leaderboardId as input

    This PR enriches the action by allowing to specify the Advent of Code private leaderboard ID to handle the scenario when a user has joined a private leaderboard created by another user (the private leaderboard id URL includes the id of the user that created the leaderboard).

    The leaderboard ID input parameter is optional and if left blank it is defaulted to the userId, in order to maintain backwards compatibility.

    opened by ImperiumMaximus 2
  • Related to aoc-badges-action

    Related to aoc-badges-action

    Just found your nice looking repo. I recognized it poped up the day I shared my aoc-badges-action on reddit which has many similarities to this.

    So I'm curious, did you took inspiration from it? 😅

    One user even did get confused by the similarities of the repo and reported an error with your reop on my reddit post: xD https://www.reddit.com/r/adventofcode/comments/r6go1m/comment/hmwk903/

    If you reused any code from my repo, pls adhere to MIT License and give credit.

    Have a great Advent!

    opened by J0B10 2
  • Weird issue

    Weird issue

    So I ran the action with:

    name: Update README ⭐
    on:
      schedule:
        - cron: "51 */4 * * *"  # Every 4 hours
      workflow_dispatch:
    
    jobs:
      update-readme:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/[email protected]
          - uses: k2bd/[email protected]
            with:
              userId: 2462608
              sessionCookie: ${{ secrets.AOC_SESSION }}
              year: 2022
          - uses: stefanzweifel/git-auto-commit-ac[email protected]
            with:
              commit_message: Update README ⭐
    

    And I got really strange error:

    Run k[2](https://github.com/PanJohnny/AoC2022/actions/runs/3610080226/jobs/6083663159#step:4:2)bd/[email protected]
      with:
        userId: 2462608
        sessionCookie: ***
        year: 2022
        tableMarker: <!--- advent_readme_stars table --->
        starSymbol: ⭐
        headerPrefix: ##
        readmeLocation: README.md
    /usr/bin/docker run --name eb1e1b84158e448eba27f4a12a7c014c_94ad[3](https://github.com/PanJohnny/AoC2022/actions/runs/3610080226/jobs/6083663159#step:4:3)a --label 290506 --workdir /github/workspace --rm -e "INPUT_USERID" -e "INPUT_SESSIONCOOKIE" -e "INPUT_YEAR" -e "INPUT_LEADERBOARDID" -e "INPUT_TABLEMARKER" -e "INPUT_STARSYMBOL" -e "INPUT_HEADERPREFIX" -e "INPUT_READMELOCATION" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/AoC2022/AoC2022":"/github/workspace" 290506:eb1e1b8[4](https://github.com/PanJohnny/AoC2022/actions/runs/3610080226/jobs/6083663159#step:4:4)1[5](https://github.com/PanJohnny/AoC2022/actions/runs/3610080226/jobs/6083663159#step:4:5)8e448eba27f4a12a7c014c
    Traceback (most recent call last):
      File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 971, in json
        return complexjson.loads(self.text, **kwargs)
      File "/usr/local/lib/python3.9/json/__init__.py", line 34[6](https://github.com/PanJohnny/AoC2022/actions/runs/3610080226/jobs/6083663159#step:4:6), in loads
        return _default_decoder.decode(s)
      File "/usr/local/lib/python3.9/json/decoder.py", line 33[7](https://github.com/PanJohnny/AoC2022/actions/runs/3610080226/jobs/6083663159#step:4:7), in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
      File "/usr/local/lib/python3.9/json/decoder.py", line 355, in raw_decode
        raise JSONDecodeError("Expecting value", s, err.value) from None
    json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
        return _run_code(code, main_globals, None,
      File "/usr/local/lib/python3.9/runpy.py", line [8](https://github.com/PanJohnny/AoC2022/actions/runs/3610080226/jobs/6083663159#step:4:8)7, in _run_code
        exec(code, run_globals)
      File "/advent_readme_stars/__main__.py", line 8, in <module>
        edited = update_readme(lines)
      File "/advent_readme_stars/update.py", line 70, in update_readme
        new_readme = insert_table(reduced)
      File "/advent_readme_stars/update.py", line 53, in insert_table
        stars_info = sorted(list(get_progress()), key=lambda p: p.day)
      File "/advent_readme_stars/progress.py", line 20, in get_progress
        leaderboard_info = res.json()
      File "/usr/local/lib/python3.[9](https://github.com/PanJohnny/AoC2022/actions/runs/3610080226/jobs/6083663159#step:4:9)/site-packages/requests/models.py", line 975, in json
        raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
    requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
    
    opened by PanJohnny 1
  • Speed up action container build

    Speed up action container build

    Hey, thank you for building this!

    I noticed that the action takes a while to build each time a workflow using it runs. For me, it's around 35-40 seconds that are added to each run. With a cron workflow dispatch, this can add up.

    I looked at the logs and noticed that the Dockerfile installs poetry in the container. I tested a simpler install method on my fork, which brought the docker build time down by around 10 seconds.

    Would you accept a PR for this?

    opened by fspoettel 1
  • Action failed to run on my repo

    Action failed to run on my repo

    I tried following the steps and ran the workflow manually on my repo to generate the table the first time (without waiting for the timer to fire). The AOC_SESSION secret is correctly added in my repo.

    The Run k2bd/[email protected] step failed, here is its output:

    Run k2bd/[email protected]
      with:
        userId: 174098
        sessionCookie: ***
        tableMarker: <!--- advent_readme_stars table --->
        starSymbol: ⭐
        headerPrefix: ##
        readmeLocation: README.md
    /usr/bin/docker run --name a68251537f80c168747cd92339d70696f9b51_3a71a7 --label 6a6825 --workdir /github/workspace --rm -e INPUT_USERID -e INPUT_SESSIONCOOKIE -e INPUT_LEADERBOARDID -e INPUT_TABLEMARKER -e INPUT_STARSYMBOL -e INPUT_YEAR -e INPUT_HEADERPREFIX -e INPUT_READMELOCATION -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/advent-of-code-2021/advent-of-code-2021":"/github/workspace" 6a6825:1537f80c168747cd92339d70696f9b51
    Traceback (most recent call last):
      File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
        return _run_code(code, main_globals, None,
      File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
        exec(code, run_globals)
      File "/usr/local/lib/python3.9/site-packages/advent_readme_stars/__main__.py", line 8, in <module>
        edited = update_readme(lines)
      File "/usr/local/lib/python3.9/site-packages/advent_readme_stars/update.py", line 70, in update_readme
        new_readme = insert_table(reduced)
      File "/usr/local/lib/python3.9/site-packages/advent_readme_stars/update.py", line 53, in insert_table
        stars_info = sorted(list(get_progress()), key=lambda p: p.day)
      File "/usr/local/lib/python3.9/site-packages/advent_readme_stars/progress.py", line 20, in get_progress
        leaderboard_info = res.json()
      File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 910, in json
        return complexjson.loads(self.text, **kwargs)
      File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
        return _default_decoder.decode(s)
      File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
      File "/usr/local/lib/python3.9/json/decoder.py", line 355, in raw_decode
        raise JSONDecodeError("Expecting value", s, err.value) from None
    json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
    
    opened by csj 1
  • Use `pip` for installing docker dependencies

    Use `pip` for installing docker dependencies

    This changes the Dockerfile to use pip for installing dependencies instead of poetry. This saves time by avoiding to having to install poetry in the container.

    closes #7

    opened by fspoettel 0
  • Bump certifi from 2022.9.24 to 2022.12.7

    Bump certifi from 2022.9.24 to 2022.12.7

    Bumps certifi from 2022.9.24 to 2022.12.7.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Add a solutions column

    Add a solutions column

    This PR adds an extra solution column that directly links to your solution file for the specific day.

    Here someone has committed day 1 in their repo but has yet to commit day 2: | Day | Solution | Part 1 | Part 2 | | :---: | :---: | :---: | :---: | | Day 1 | 01.rs | ⭐ | ⭐ | | Day 2 | | ⭐ | ⭐ |

    To facilitate this two new options were added to the Action:

    • solutionLocations which allows you to specify where each solution would be located relative to the readme file. (in the form "src/bin/{}.rs")
    • solutionPadding which can optionally pad your day numbers (1 becomes 01)

    Unfortunately I was unable to create any tests (but I have tested locally) as the test framework just errors with TypeError: required field "lineno" missing from alias.

    opened by miam-miam100 0
  • Update actions/checkout version

    Update actions/checkout version

    actions/[email protected] uses node 12, which results in a warning that reads:

    Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. Please update the following actions to use Node.js 16: actions/[email protected]

    PR #12 fixes this.

    opened by MrOnosa 0
  • Updating dependency so it uses node 16

    Updating dependency so it uses node 16

    actions/[email protected] uses node 12, which results in a warning that reads:

    Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. Please update the following actions to use Node.js 16: actions/[email protected]

    Luckily, actions/[email protected] uses node 16. This is a non-breaking change.

    opened by MrOnosa 0
  • show compleation time

    show compleation time

    hi

    it would be cool if there was an option to also show how long it took to complete each part. this info is included in the api (as a unix time stamp) so adding it should be simple.

    i am happy to take a crack at this and make a PR if you are open to it.

    opened by TomW1605 0
Releases(v1.0.3)
  • 1.0.2(Dec 1, 2022)

    Improve action time a bit

    What's Changed

    • Update README.md by @csj in https://github.com/k2bd/advent-readme-stars/pull/6
    • Use pip for installing docker dependencies by @fspoettel in https://github.com/k2bd/advent-readme-stars/pull/8

    New Contributors

    • @csj made their first contribution in https://github.com/k2bd/advent-readme-stars/pull/6
    • @fspoettel made their first contribution in https://github.com/k2bd/advent-readme-stars/pull/8

    Full Changelog: https://github.com/k2bd/advent-readme-stars/compare/v1.0.1...1.0.2

    Source code(tar.gz)
    Source code(zip)
  • v1.0.1(Dec 2, 2021)

    What's Changed

    • Specify an (optional) private leaderboardId as input by @ImperiumMaximus in https://github.com/k2bd/advent-readme-stars/pull/3

    New Contributors

    • @ImperiumMaximus made their first contribution in https://github.com/k2bd/advent-readme-stars/pull/3

    Full Changelog: https://github.com/k2bd/advent-readme-stars/commits/v1.0.1

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Dec 1, 2021)

    First release of the advent-readme-stars action.

    This action can automatically maintain a table of your progress within your Advent of Code repo!

    See the README for more details.

    Source code(tar.gz)
    Source code(zip)
Owner
Kevin Duff
Scientific Software Developer
Kevin Duff
Disqus API bindings for Python

disqus-python Let's start with installing the API: pip install disqus-python Use the API by instantiating it, and then calling the method through dott

DISQUS 163 Oct 14, 2022
Fast and multi-threaded script to automatically claim targeted username including 14 day bypass

Instagram Username Auto Claimer Fast and multi-threaded script to automatically claim targeted username. Click here to report bugs. Usage Download ZIP

265 Dec 28, 2022
An open-source Discord Bot Project based on programming!

An open-source Discord Bot Project based on programming!

Vladimer Moore 2 Aug 22, 2022
DiscWrappy - A Python wrapper for the Discord bot API

DiscWrappy - A Python wrapper for the Discord bot API

Jeff Morris 4 Apr 25, 2022
Bot that embeds a random hysterical meme from Reddit into your text channel as an embedded message, using an API call.

Discord_Meme_Bot 🤣 Bot that embeds a random hysterical meme from Reddit into your text channel as an embedded message, using an API call. Add the bot

2 Jan 16, 2022
Download videos from Youtube and other platforms through a Telegram Bot

ytdl-bot Download videos from YouTube and other platforms through a Telegram Bot Usage: https://t.me/benny_ytdlbot Send link from YouTube directly to

Telegram Bot Collection 289 Jan 03, 2023
Short Program using Transavia's API to notify via email an user waiting for a flight at special dates and with the best price

Flight-Notifier Short Program using Transavia's API to notify via email an user waiting for a flight at special dates and with the best price Algorith

Wassim 2 Apr 10, 2022
A Python client for the Softcite software mention recognizer server

Softcite software mention recognizer client Python client for using the Softcite software mention recognition service. It can be applied to individual

4 Feb 02, 2022
❤️A next gen powerful telegram group manager bot for manage your groups and have fun with other cool modules

Natsuki Based on Python Telegram Bot Contributors Video Tutorial: Complete guide on deploying @TheNatsukiBot's clone on Heroku. ☆ Video by Sadew Jayas

Pawan Theekshana 8 Oct 06, 2022
Kevin L. 3 Jul 14, 2022
Rocks vc Userbot: A Telegram Bot Project That's Allow You To Play Audio And Video Music On Telegram Voice Chat Group

⭐️ Rocks VC Userbot ⭐️ Telegram Userbot To Play Audio And Video Song On VC Chat

Dr Asad Ali 10 Jul 18, 2022
A Python script that exports users from one Telegram group to another using one or more concurrent user bots.

ExportTelegramUsers A Python script that exports users from one Telegram group to another using one or more concurrent user bots. Make sure to set all

Fasil Minale 17 Jun 26, 2022
Telegram chats reader with python

Telegram chat reader Программа полностью сливает чаты телеграм в базу данных PostgreSQL. Для использования нужен развернутый сервер постгрес и телегра

Anton 4 Dec 24, 2021
Request based Python module(s) to help with the Newegg raffle.

Newegg Shuffle Python module(s) to help you with the Newegg raffle How to use $ git clone https://github.com/Matthew17-21/Newegg-Shuffle $ cd Newegg-S

Matthew 45 Dec 01, 2022
TM1py is a Python package that wraps the TM1 REST API in a simple to use library.

By wrapping the IBM Planning Analytics (TM1) REST API in a concise Python framework, TM1py facilitates Python developments for TM1. Interacting with T

Cubewise CODE 147 Dec 15, 2022
a discord bot for searching your movies, and bot return movie url for you :)

IMDb Discord Bot how to run this bot. the first step you must create prefixes.json file the second step you must create a virtualenv if you use window

Mehdi Radfar 6 Dec 20, 2022
:snake: A simple library to fetch data from the iTunes Store API made for Python >= 3.5

itunespy itunespy is a simple library to fetch data from the iTunes Store API made for Python 3.5 and beyond. Important: Since version 1.6 itunespy no

Fran González 56 Dec 22, 2022
A GUI Weather Application written with Python

weather-box - A GUI Weather Application written with Python Made with ❤️ by Suresh Mishra

Suresh Mishra 2 Dec 18, 2021
Jackrabbit Relay is an API endpoint for stock, forex and cryptocurrency exchanges that accept REST webhooks.

JackrabbitRelay Jackrabbit Relay is an API endpoint for stock, forex and cryptocurrency exchanges that accept REST webhooks. Disclaimer Please note RA

Rose Heart 23 Jan 04, 2023
tgEasy's Official Assistant Bot and Example Bot

tgEasy Assistant The assistant bot that helps people with tgEasy directly on Telegram. This repository contains the source code of @tgEasyRobot and th

Divide Projects™ 4 Dec 26, 2022