From 53a59657a5e4613dd6bdb91636a54c3c38a44df0 Mon Sep 17 00:00:00 2001 From: Tristan Guichaoua Date: Thu, 23 Nov 2023 09:40:38 +0100 Subject: [PATCH 1/5] update checkout to v4 --- .github/workflows/readme-stars.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/readme-stars.yml b/.github/workflows/readme-stars.yml index 4b943fa..18a0130 100644 --- a/.github/workflows/readme-stars.yml +++ b/.github/workflows/readme-stars.yml @@ -10,7 +10,7 @@ jobs: update-readme: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 if: ${{ env.AOC_ENABLED }} env: AOC_ENABLED: ${{ secrets.AOC_ENABLED }} From f0a9d487e8bb0dcfe1fc59bc387f7b4b912c6a43 Mon Sep 17 00:00:00 2001 From: Tristan Guichaoua Date: Thu, 23 Nov 2023 09:40:56 +0100 Subject: [PATCH 2/5] update git-auto-commit-action to v5 --- .github/workflows/readme-stars.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/readme-stars.yml b/.github/workflows/readme-stars.yml index 18a0130..03cf558 100644 --- a/.github/workflows/readme-stars.yml +++ b/.github/workflows/readme-stars.yml @@ -22,7 +22,7 @@ jobs: userId: ${{ secrets.AOC_USER_ID }} sessionCookie: ${{ secrets.AOC_SESSION }} year: ${{ secrets.AOC_YEAR }} - - uses: stefanzweifel/git-auto-commit-action@v4 + - uses: stefanzweifel/git-auto-commit-action@v5 if: ${{ env.AOC_ENABLED }} env: AOC_ENABLED: ${{ secrets.AOC_ENABLED }} From 9e6c1ee5aa7202db930b98df61896251af198f22 Mon Sep 17 00:00:00 2001 From: Tristan Guichaoua Date: Thu, 23 Nov 2023 09:41:24 +0100 Subject: [PATCH 3/5] add write permission --- .github/workflows/readme-stars.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/readme-stars.yml b/.github/workflows/readme-stars.yml index 03cf558..b298136 100644 --- a/.github/workflows/readme-stars.yml +++ b/.github/workflows/readme-stars.yml @@ -9,6 +9,8 @@ on: jobs: update-readme: runs-on: ubuntu-latest + permissions: + contents: write steps: - uses: actions/checkout@v4 if: ${{ env.AOC_ENABLED }} From 3e99d7b23b7fb33d1e5c100770046e2fda04f6b1 Mon Sep 17 00:00:00 2001 From: Tristan Guichaoua Date: Thu, 23 Nov 2023 09:41:45 +0100 Subject: [PATCH 4/5] fix run condition --- .github/workflows/readme-stars.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/readme-stars.yml b/.github/workflows/readme-stars.yml index b298136..7e80be7 100644 --- a/.github/workflows/readme-stars.yml +++ b/.github/workflows/readme-stars.yml @@ -13,11 +13,11 @@ jobs: contents: write steps: - uses: actions/checkout@v4 - if: ${{ env.AOC_ENABLED }} + if: ${{ env.AOC_ENABLED == 'true' }} env: AOC_ENABLED: ${{ secrets.AOC_ENABLED }} - uses: k2bd/advent-readme-stars@v1 - if: ${{ env.AOC_ENABLED }} + if: ${{ env.AOC_ENABLED == 'true' }} env: AOC_ENABLED: ${{ secrets.AOC_ENABLED }} with: @@ -25,7 +25,7 @@ jobs: sessionCookie: ${{ secrets.AOC_SESSION }} year: ${{ secrets.AOC_YEAR }} - uses: stefanzweifel/git-auto-commit-action@v5 - if: ${{ env.AOC_ENABLED }} + if: ${{ env.AOC_ENABLED == 'true' }} env: AOC_ENABLED: ${{ secrets.AOC_ENABLED }} with: From 6334ed20faeee9d24b33932c57ce42d783b3544c Mon Sep 17 00:00:00 2001 From: Tristan Guichaoua Date: Thu, 23 Nov 2023 10:02:13 +0100 Subject: [PATCH 5/5] use variable + move run condition to job --- .github/workflows/readme-stars.yml | 10 +--------- README.md | 7 +++++-- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/readme-stars.yml b/.github/workflows/readme-stars.yml index 7e80be7..1dec447 100644 --- a/.github/workflows/readme-stars.yml +++ b/.github/workflows/readme-stars.yml @@ -9,24 +9,16 @@ on: jobs: update-readme: runs-on: ubuntu-latest + if: ${{ vars.AOC_ENABLED == 'true' }} permissions: contents: write steps: - uses: actions/checkout@v4 - if: ${{ env.AOC_ENABLED == 'true' }} - env: - AOC_ENABLED: ${{ secrets.AOC_ENABLED }} - uses: k2bd/advent-readme-stars@v1 - if: ${{ env.AOC_ENABLED == 'true' }} - env: - AOC_ENABLED: ${{ secrets.AOC_ENABLED }} with: userId: ${{ secrets.AOC_USER_ID }} sessionCookie: ${{ secrets.AOC_SESSION }} year: ${{ secrets.AOC_YEAR }} - uses: stefanzweifel/git-auto-commit-action@v5 - if: ${{ env.AOC_ENABLED == 'true' }} - env: - AOC_ENABLED: ${{ secrets.AOC_ENABLED }} with: commit_message: "update readme progess" diff --git a/README.md b/README.md index 8f3abb1..3908e78 100644 --- a/README.md +++ b/README.md @@ -161,7 +161,7 @@ cargo read ### Configure aoc-cli integration 1. Install [`aoc-cli`](https://github.com/scarvalhojr/aoc-cli/) via cargo: `cargo install aoc-cli --version 0.12.0` -2. Create an `.adventofcode.session` file in your home directory and paste your session cookie. To retrieve the session cookie, press F12 anywhere on the Advent of Code website to open your browser developer tools. Look in _Cookies_ under the _Application_ or _Storage_ tab, and copy out the `session` cookie value. [^1] +2. Create an `.adventofcode.session` file in your home directory and paste your session cookie. To retrieve the session cookie, press F12 anywhere on the Advent of Code website to open your browser developer tools. Look in _Cookies_ under the _Application_ or _Storage_ tab, and copy out the `session` cookie value. [^1] Once installed, you can use the [download command](#download-input--description-for-a-day) and automatically submit solutions via the [`--submit` flag](#submitting-solutions). @@ -179,11 +179,14 @@ Go to the leaderboard page of the year you want to track and click _Private Lead Go to the _Secrets_ tab in your repository settings and create the following secrets: -- `AOC_ENABLED`: This variable controls whether the workflow is enabled. Set it to `true` to enable the progress tracker. - `AOC_USER_ID`: Go to [this page](https://adventofcode.com/settings) and copy your user id. It's the number behind the `#` symbol in the first name option. Example: `3031`. - `AOC_YEAR`: the year you want to track. Example: `2021`. - `AOC_SESSION`: an active session[^2] for the advent of code website. 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. +Go to the _Variables_ tab in your repository settings and create the following variable: + +- `AOC_ENABLED`: This variable controls whether the workflow is enabled. Set it to `true` to enable the progress tracker. + ✨ You can now run this action manually via the _Run workflow_ button on the workflow page. If you want the workflow to run automatically, uncomment the `schedule` section in the `readme-stars.yml` workflow file or add a `push` trigger. ### Check code formatting / clippy lints in CI