Download input file #27
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
name: Download input file | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 5 * 12 *" # Might need to delay this a minute, but GHA startup time is likely longer than any time skew. | |
permissions: | |
contents: write | |
jobs: | |
download: | |
name: Fetch today's input file | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup env | |
run: echo "DAY=$(date +'%d')" >> $GITHUB_ENV | |
- name: Make dir if not exist | |
run: mkdir -p "Day_${DAY}" | |
- name: Get file | |
env: | |
SESSION_COOKIE: ${{ secrets.SESSION_COOKIE }} | |
run: | | |
curl "https://adventofcode.com/2023/day/$((10#$DAY + 0))/input" --compressed -H "Cookie: ${SESSION_COOKIE}" > "Day_${DAY}/${DAY}.in" | |
# Funky eval around DAY to remove zero-padding. | |
- name: Commit changes | |
run: | | |
git config user.name github-actions[bot] | |
git config user.email github-actions[bot]@users.noreply.github.com | |
git add . | |
git commit -am "Input file for day ${DAY}" | |
git push |