ci: update readme-stars workflow (#36)

* update checkout action to v4
* update git-auto-commit-action to v5, add required write permission
* use variable for run condition, check on job level
This commit is contained in:
Tristan Guichaoua 2023-11-24 09:25:37 +01:00 committed by GitHub
parent 656bd38f4c
commit 751fde7451
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 13 deletions

View file

@ -9,22 +9,16 @@ on:
jobs: jobs:
update-readme: update-readme:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ vars.AOC_ENABLED == 'true' }}
permissions:
contents: write
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
if: ${{ env.AOC_ENABLED }}
env:
AOC_ENABLED: ${{ secrets.AOC_ENABLED }}
- uses: k2bd/advent-readme-stars@v1 - uses: k2bd/advent-readme-stars@v1
if: ${{ env.AOC_ENABLED }}
env:
AOC_ENABLED: ${{ secrets.AOC_ENABLED }}
with: with:
userId: ${{ secrets.AOC_USER_ID }} userId: ${{ secrets.AOC_USER_ID }}
sessionCookie: ${{ secrets.AOC_SESSION }} sessionCookie: ${{ secrets.AOC_SESSION }}
year: ${{ secrets.AOC_YEAR }} 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 }}
with: with:
commit_message: "update readme progess" commit_message: "update readme progess"

View file

@ -161,7 +161,7 @@ cargo read <day>
### Configure aoc-cli integration ### Configure aoc-cli integration
1. Install [`aoc-cli`](https://github.com/scarvalhojr/aoc-cli/) via cargo: `cargo install aoc-cli --version 0.12.0` 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). 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: 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_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_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. - `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. ✨ 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 ### Check code formatting / clippy lints in CI