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/checkout@v2
      - uses: k2bd/advent-readme-stars@v1
        with:
          userId: 1234567
          leaderboardId: 9876543
          sessionCookie: ${{ secrets.AOC_SESSION }}
      - uses: stefanzweifel/git-auto-commit-action@v4
        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/checkout@v2
          - uses: k2bd/advent-readme-stars@v1
            with:
              userId: 2462608
              sessionCookie: ${{ secrets.AOC_SESSION }}
              year: 2022
          - uses: stefanzweifel/git-auto-commit-action@v4
            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/advent-readme-stars@v1
      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/advent-readme-stars@v1 step failed, here is its output:

    Run k2bd/advent-readme-stars@v1
      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/checkout@v2 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/checkout@v2

    PR #12 fixes this.

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

    Updating dependency so it uses node 16

    actions/checkout@v2 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/checkout@v2

    Luckily, actions/checkout@v3 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
Support for Competitive Coding badges to add in Github readme or portfolio websites.

Support for Competitive Coding badges to add in Github readme or portfolio websites.

Akshat Aggarwal 2 Feb 14, 2022
Auto Join: A GitHub action script to automatically invite everyone to the organization who comment at the issue page.

Auto Invite To Org By Issue Comment A GitHub action script to automatically invite everyone to the organization who comment at the issue page. What is

Max Base 6 Jun 8, 2022
Github action for automatically determine the version for next release by using repository tags

This action will automatically determine the version for next release by using repository tags

Igor Gov 7 Oct 25, 2022
Upload comma-delimited files to biglocalnews.org in your GitHub Action

Upload comma-delimited files to biglocalnews.org in your GitHub Action Inputs api-key: Your biglocalnews.org API token. project-id: The identifier of

biglocalnews 1 Apr 20, 2022
My Advent of Code solutions. I also upload videos of my solves: https://www.youtube.com/channel/UCuWLIm0l4sDpEe28t41WITA

My solutions to adventofcode.com puzzles. I post videos of me solving the puzzles in real-time at https://www.youtube.com/channel/UCuWLIm0l4sDpEe28t41

null 195 Jan 4, 2023
Copier template for solving Advent of Code puzzles with Python

Advent of Code Python Template for Copier This template creates scaffolding for one day of Advent of Code. It includes tests and can download your per

Geir Arne Hjelle 6 Dec 25, 2022
Discord bot to display private leaderboards for Advent of Code.

Advent Of Code Discord Bot Discord bot for displaying Advent of Code private leardboards, as well as custom leaderboards where participants can set th

The Future Gadgets Lab 6 Nov 29, 2022
A github actions + python code to extract URLs to code repositories to put into standard form, starting with github

A github actions + python code to extract URLs to code repositories to put into standard form, starting with github ---- NOTE: JUS

Justin Gosses 2 Nov 15, 2021
Name says it all/Instructions are in README file.

Discord-Webhook-Spammer Name says it all/Instructions are in README file. Setup 1. pip install discord-webhook ( In console, terminal or whatever you

Catto 1 Mar 21, 2022
GitHub action to deploy serverless functions to YandexCloud

YandexCloud serverless function deploy action Deploy new serverless function version (including function creation if it does not exist). Inputs yc_acc

Много Лосося 4 Apr 10, 2022
A repo-watcher to watch for commits on a repo an trigger GitHub action by sending a `repository_dispatch` event to destinantion repo

repo-watcher-dispatch-sender This app is used to send a repository_dispatch event to the destination repo set in config.py or Environmental Variables

Divide Projects™ 2 Feb 6, 2022
📖 GitHub action schedular (cron) that posts a Hadith every hour on Twitter & Facebook.

Hadith Every Hour ?? A bot that posts a Hadith every hour on Twitter & Facebook (Every 3 hours for now to avoid spamming) Follow on Twitter @HadithEve

Ananto 13 Dec 14, 2022
in-progress decompilation of Gauntlet Legends decompression code on the N64

Gauntlet-Legends A in-progress decompilation of Gauntlet-Legends (N64) decompression code. This project currently supports the US release. Building (L

null 6 Jul 23, 2022
Public Mirror of Team 15's Code and Reports for RBE 3002 B21

RBE3002 Team 15 Lab Repository Team 15's Repository for all code written for RBE 3002 using the Robotis TurtleBot3 Written By Matthew Haahr, Leo Morri

Matthew Haahr 3 Mar 21, 2022
AWS Auto Inventory allows you to quickly and easily generate inventory reports of your AWS resources.

Photo by Denny Müller on Unsplash AWS Automated Inventory ( aws-auto-inventory ) Automates creation of detailed inventories from AWS resources. Table

AWS Samples 123 Dec 26, 2022
Discord Bot for server hosts, devs, and admins. Analyzes timings reports & uploads text files to hastebin. Developed by https://birdflop.com.

"Botflop" Click here to invite Botflop to your server. Current abilities Analyze timings reports Paste a timings report to review an in-depth descript

Purpur 76 Dec 31, 2022
A self hosted slack bot to conduct standups & generate reports.

StandupMonkey A self hosted slack bot to conduct standups & generate reports. Report Bug · Request Feature Installation Install already hosted bot (Us

Muhammad Haseeb 69 Jan 1, 2023
A program used to create accounts in bulk, still a work in progress as of now.

Discord Account Creator This project is still a work in progress. It will be published upon its full completion. About This project is still under dev

patched 8 Sep 15, 2022
a small cli to generate AWS Well Architected Reports on the road

well-architected-review This repo intends to publish some scripts related to Well Architected Reviews. war.py extracts in txt & xlsx files all the WAR

null 4 Mar 18, 2022