Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create workflow to fetch puzzle #4

Open
brendanator opened this issue Dec 24, 2024 · 2 comments · May be fixed by #11
Open

Create workflow to fetch puzzle #4

brendanator opened this issue Dec 24, 2024 · 2 comments · May be fixed by #11

Comments

@brendanator
Copy link
Contributor

  • Create GitHub workflow called fetch-puzzle.yml to fetch advent of code puzzles
  • Trigger it:
    • cron - 5pm UTC between 1-25 December (12 hours after the puzzle is published)
    • workflow_dispatch - taking year and day as arguments
  • Set env vars
    • AOC_SESSION: secrets.AOC_SESSION
  • Add permissions needed: content, issues
  • Set up
    • Check out repo - uses: actions/checkout@v4
    • Setup uv - uses astral-sh/setup-uv@v4 and uv sync
  • Download the puzzle
    • Run uv run advent_of_code.py download {year} {day} and store the stdout as the part in $GITHUB_OUTPUT
  • Commit and push puzzle in puzzles/year_{year}/day_{day} with user GitHub Actions
  • Trigger create-puzzle-issue.yml using the year, day and part
    • uses: sourcery-ai/autonomous-advent-of-code/.github/workflows/create-puzzle-issue.yml@main
@brendanator
Copy link
Contributor Author

@sourcery-ai develop

Copy link
Contributor

sourcery-ai bot commented Dec 24, 2024

Objectives

  • Create a GitHub Actions workflow file .github/workflows/fetch-puzzle.yml
  • Configure workflow triggers for 5pm UTC cron job (Dec 1-25) and manual dispatch with year/day inputs
  • Set up required environment variables and permissions for repository content and issues
  • Configure workflow to use actions/checkout@v4 for repository access
  • Set up Python environment using astral-sh/setup-uv@v4 and initialize dependencies
  • Execute advent_of_code.py to download puzzle and capture output
  • Create puzzle directory structure at puzzles/year_{year}/day_{day}
  • Commit and push downloaded puzzle content using GitHub Actions bot
  • Trigger downstream workflow create-puzzle-issue.yml with year, day, and puzzle part parameters

File changes

.github/workflows/fetch-puzzle.yml

  • Create new GitHub Actions workflow file for fetching puzzles
  • Add workflow triggers for cron at 5pm UTC during December 1-25 and workflow_dispatch with year/day inputs
  • Configure AOC_SESSION environment variable from secrets
  • Set permissions for repository content and issues
  • Add checkout step using actions/checkout@v4
  • Add Python setup using astral-sh/setup-uv@v4
  • Add step to run advent_of_code.py download with year and day parameters
  • Add step to commit and push puzzle files using GitHub Actions bot
  • Add step to trigger create-puzzle-issue.yml workflow with year, day, and part parameters

Verify changes

  • uv run ruff .github/workflows/fetch-puzzle.yml
  • uv run ruff format .github/workflows/fetch-puzzle.yml

This plan was automatically generated.
Please review the plan carefully and make any necessary adjustments.

sourcery-ai bot added a commit that referenced this issue Dec 24, 2024
CI:
- Set up a workflow to automatically fetch Advent of Code puzzles daily at 5pm UTC during December and allow manual dispatch.

Resolves #4
@sourcery-ai sourcery-ai bot linked a pull request Dec 24, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant