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

CI: Add workflow to create Advent of Code puzzle issues #10

Merged
merged 1 commit into from
Dec 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/create-puzzle-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Create Puzzle Issue

on:
workflow_call:
inputs:
year:
required: true
type: number
description: "The year of the puzzle"
day:
required: true
type: number
description: "The day of the puzzle"
part:
required: true
type: number
description: "The part of the puzzle (1 or 2)"

permissions:
issues: write

jobs:
create-issue:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.USER_TOKEN }}
steps:
- name: Create puzzle issue
id: create-issue
run: |
ISSUE_URL=$(gh issue create \
--title "Advent of code - ${{ inputs.year }} day ${{ inputs.day }} part ${{ inputs.part }}" \
--body "Write solution in \`puzzles/year_${{ inputs.year }}/day_${{ inputs.day }}/solution.py\`, and write tests in \`puzzles/year_${{ inputs.year }}/day_${{ inputs.day }}/test_solution.py\` using relative imports")
echo "issue_url=${ISSUE_URL}" >> $GITHUB_OUTPUT

- name: Add sourcery comment
run: |
gh issue comment "${ISSUE_URL}" --body "@sourcery-ai develop - you can read the puzzle statement with \`uv run advent_of_code.py read ${{ inputs.year }} ${{ inputs.day }} ${{ inputs.part }}\`. Run the solution on \`puzzles/year_${{ inputs.year }}/day_${{ inputs.day }}/input.txt\` and write answer to \`puzzles/year_${{ inputs.year }}/day_${{ inputs.day }}/answer_part${{ inputs.part }}.txt\`"
env:
ISSUE_URL: ${{ steps.create-issue.outputs.issue_url }}
Loading