2023 Day 2 Part 2 Complete #81
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inspired By https://github.com/J0B10/aoc-badges-action#sample-workflow | |
name: Gather AOC Stars | |
on: [push] | |
jobs: | |
gather-stars: | |
runs-on: ubuntu-latest | |
container: | |
image: blacktop/httpie | |
env: | |
SESSION: ${{ secrets.AOC_SESSION }} | |
USERID: 1063637 | |
USERAGENT: "User-Agent: HTTPie - https://github.com/pcorliss/advent_of_code/ - pcorliss@gmail.com" | |
steps: | |
- name: Download Leaderboards | |
run: | | |
for YEAR in `seq 2015 2023`; do | |
http --download GET https://adventofcode.com/$YEAR/leaderboard/private/view/$USERID.json "$USERAGENT" Cookie:session=$SESSION >> $YEAR.json | |
done | |
echo STARS=$(cat *.json | jq ".members[\"$USERID\"].stars" | jq -s '. | add') >> $GITHUB_ENV | |
- name: Show Stars | |
run: echo $STARS | |
- name: Create Awesome Badge | |
uses: schneegans/dynamic-badges-action@v1.1.0 | |
with: | |
auth: ${{ secrets.GIST_SECRET }} | |
gistID: 2cc2a13636cb044176c0fa1e7bcf7ec2 | |
filename: aoc_stars.json | |
label: 'Stars' | |
message: ${{ env.STARS }} | |
color: yellow |