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
A ideia é fornecer uma base ampla de questões do ENEM como uma api REST

base10 "A ideia é fornecer uma base ampla de questões do ENEM como uma api REST" TODO Documentar a api com apifairy Criar testes Criar crawler para si

Wadson Garbes 4 Apr 24, 2022
Python bindings for Alexa Web Information Service (AWIS) API

Attention! This package is no longer maintained. See this ticket for more info. Wraps Alexa Web Information Service. Usage Making UrlInfo requests: ap

Atamert Ölçgen 51 Feb 12, 2022
Discord E-Store Bot

A delivery bot for Discord, works like Amazon where real users can pack & deliver orders in different servers!

Amit Pathak 2 Jan 28, 2022
A Twitter bot developed in Python using the Tweepy library and hosted in AWS.

Twitter Cameroon: @atangana_aron A Twitter bot developed in Python using the Tweepy library and hosted in AWS. https://twitter.com/atangana_aron Cost

1 Jan 30, 2022
Student-Management-System-in-Python - Student Management System in Python

Student-Management-System-in-Python Student Management System in Python

G.Niruthian 3 Jan 01, 2022
Simple Discord bot for snekbox (sandboxed Python code execution), self-host or use a global instance

snakeboxed Simple Discord bot for snekbox (sandboxed Python code execution), self-host or use a global instance

0 Jun 25, 2022
Validate all your Customer IAM Policies against AWS Access Analyzer - Policy Validation

✅ Access Analyzer - Batch Policy Validator This script will analyze using AWS Access Analyzer - Policy Validation all your account customer managed IA

Victor GRENU 41 Dec 12, 2022
Wordnik Python public library

Python 2.7 client for Wordnik.com API Overview This is a Python 2.7 client for the Wordnik.com v4 API. For more information, see http://developer.word

Wordnik 224 Dec 29, 2022
“ HOLA HUMANS 👋 I'M DAISYX 2.0 ❤️ „ LATEST VERSION OF DAISYX.. Source Code of @Daisyxbot

❤️ DaisyX 2.0 ❤️ A Powerful, Smart And Simple Group Manager ... Written with AioGram , Pyrogram and Telethon... ⭐️ Thanks to everyone who starred Dais

TeamDaisyX 153 Dec 06, 2022
A simple Discord bot written in Python

Acolyte A small and simple little Discord bot written in Python that utilizes the discord.py library. Dependencies The bot depends on Python 3.9 and u

0 Jul 17, 2021
WikipediaBot from mohirdev.uz

wiki-bot WikipediaBot from mohirdev.uz Requirements wikipedia aiogram Installing wiki/aiogram pip install wikipedia pip install aiogram

Muhammad Ali 5 Sep 28, 2022
AKShare is an elegant and simple financial data interface library for Python, built for human beings

AKShare is an elegant and simple financial data interface library for Python, built for human beings

AKFamily 5.8k Dec 30, 2022
PokemonGo-Bot - The Pokemon Go Bot, baking with community.

PokemonGo-Bot PokemonGo-Bot is a project created by the PokemonGoF team. Since no public API available for now, a patch to use HASH-Server was applied

3.8k Jan 08, 2023
Generate discord nitro codes and check them

Discord Nitro Generator and Checker A discord nitro generator and checker for all your nitro needs Explore the docs » Report Bug · Request Feature · J

509 Jan 02, 2023
A very tiny python api for the stock exchange tradegate.de

pytradegate A very tiny python api for the stock exchange tradegate.de The api provides the recent ask/bid data and all other data as found on the det

dunderstr aka seimen 7 Aug 24, 2022
A Python script to create customised Spotify playlists using the JSON, Spotipy Library and Spotify Web API, based on seed tracks in your history.

A Python script to create customised Spotify playlists using the JSON, Spotipy Library and Spotify Web API, based on seed tracks in your history.

Youngseo Park 1 Feb 01, 2022
Demo of using Telegram to send alert message

MIAI_Telegram Demo of using Telegram to send alert message Video link: https://youtu.be/oZ9CsIrlMgg #MìAI Fanpage: http://facebook.com/miaiblog Group

4 Jun 20, 2021
⛑ REDCap API interface in Python

REDCap API in Python Description Supports structured data extraction for REDCap projects. The API module d3b_redcap_api.redcap.REDCapStudy can be logi

D3b 1 Nov 21, 2022
Spacecrypto-bombcrypto-bot - SpaceCrypto And Bombcrypto Bot - MultiScreen

SpaceCrypto And Bombcrypto Bot - MultiScreen This is a open source project inspi

Paulo Bramante 5 Nov 03, 2022
🔍 📊 Look up information about anime, manga and much more directly in Discord!

AniSearch The source code of the AniSearch Discord Bot. Contribute You have an idea or found a bug? Open a new issue with detailed explanation. You wa

私はレオンです 19 Dec 07, 2022