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
Production Ontology Merging (PrOM) Framework

Production Ontology Merging (PrOM) Framework OWL 2 DL ontology merging framework tailored to the production domain Features preprocessing: translation

4 Nov 02, 2022
A simple tool that allows you to change your default AWS CLI profile.

Select AWS Profile Select AWS Profile (slapr) is a simple tool that lets you select which AWS Profile you want to use and sets it as the default AWS p

Antoni Yanev 2 Nov 09, 2022
Check AWS S3 instances for read/write/delete access

s3sec Test AWS S3 buckets for read/write/delete access This tool was developed to quickly test a list of s3 buckets for public read, write and delete

0xmoot 114 Dec 06, 2022
A Bot to Track Kernel Upstreams from kernel.org and Post it on Telegram Channel

Channel Kernel Tracker is the channel where the bot will be sending the updates in. Introduction This is a Telegram Bot to Track Kernel Upstreams kern

Kartikeya Hegde 3 Oct 05, 2021
Console BeautifulDiscord theme manager

BeautifulDiscord theme manager Console script for downloading & managing Discord .css themes via BeautifulDiscord. Setup Simply run # Linux/MacOS pip3

1 Dec 15, 2022
A template that help you getting started with Pycord.

A Pycord Template with some example! Getting Started: Clone this repository using git clone https://github.com/AungS8430/pycord-template.git If you ha

2 Feb 10, 2022
Protect Discord server invite link

DiscordOauth2Join Protect discord server invite links! Setup I will not help setting up the discord application, but just python. First, install the r

ZEEE 4 Aug 12, 2021
allow windows programs to call dssp/mkdssp command from wsl; rework biopython on windows (PDB -> dssp -> fasta)

dssp-wsl Converting PDB (Protein Data Bank) file format to DSSP file format is required for generating datasets of peptides and their secondary struct

Taine Zhao 1 Feb 23, 2022
Python Script to download hundreds of images from 'Google Images'. It is a ready-to-run code!

Google Images Download Python Script for 'searching' and 'downloading' hundreds of Google images to the local hard disk! Documentation Documentation H

Hardik Vasa 8.2k Jan 05, 2023
EduuRobot Telegram bot source code.

EduuRobot A multipurpose Telegram Bot made with Pyrogram and asynchronous programming. Requirements Python 3.6+ An Unix-like operating system (Running

Amano Team 119 Dec 23, 2022
A Script to automate fowarding all new messages from one/many channel(s) to another channel(s), without the forwarded tag.

Channel Auto Message Forward A script to automate fowarding all new messages from one/many channel(s) to another channel(s), without the forwarded tag

16 Oct 21, 2022
Bearer API client for Python

Bearer Python Bearer Python client Installation pip install bearer Usage Get your Bearer Secret Key and integration id from the Dashboard and use the

Bearer 9 Oct 31, 2022
Ap lokit lokit

🎵 FANDA MUSIC BOT Fanda Music adalah proyek bot telegram yang memungkinkan Anda memutar musik di obrolan suara grup telegram. a href="https://www.py

Fatur 2 Nov 18, 2021
Graviti TensorBay Python SDK

TensorBay Python SDK is a python library to access TensorBay and manage your datasets. It provides: A pythonic way to access your

Graviti 72 Aug 22, 2022
A twitter multi-tool for OSINT on twitter accounts.

TwitterCheckr A twitter multi-tool for OSINT on twitter accounts. Infomation TwitterCheckr also known as TCheckr is multi-tool for OSINT on twitter a

IRIS 16 Dec 23, 2022
This repository contains ready to deploy automations on AWS

aws-automation-plugins This repository contains ready to deploy automations on AWS. How-To All projects in this repository contain a deploy.sh file wh

Akesh Patil 8 Sep 20, 2022
A Telegram Music Bot written in Python using Pyrogram and Py-Tgcalls

A Telegram Music Bot written in Python using Pyrogram and Py-Tgcalls. This is Also The Source Code of The UserBot Which is Playing Music in @S1-BOTS Support Group ❤️

SAF ONE 224 Dec 28, 2022
The official Python client library for the Kite Connect trading APIs

The Kite Connect API Python client - v3 The official Python client for communicating with the Kite Connect API. Kite Connect is a set of REST-like API

Zerodha Technology 756 Jan 06, 2023
Mikasa is a 100% Spanish bot, a multifunctional bot, Mikasa is in beta.

Mikasa Miaksa, It is a multi-functional discord bot that is currently in development, this is not complete, there are still many things to fix and imp

Made in 2 Oct 05, 2021