Skip to content

Commit 47e6cb7

Browse files
CI: Add workflow to create Advent of Code puzzle issues
CI: - Add a workflow to create issues for Advent of Code puzzles, including instructions for solution and test file placement, and a comment requesting automated analysis from Sourcery. Resolves #3
1 parent a5f742b commit 47e6cb7

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Create Puzzle Issue
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
year:
7+
required: true
8+
type: number
9+
description: "The year of the puzzle"
10+
day:
11+
required: true
12+
type: number
13+
description: "The day of the puzzle"
14+
part:
15+
required: true
16+
type: number
17+
description: "The part of the puzzle (1 or 2)"
18+
19+
permissions:
20+
issues: write
21+
22+
jobs:
23+
create-issue:
24+
runs-on: ubuntu-latest
25+
env:
26+
GH_TOKEN: ${{ secrets.USER_TOKEN }}
27+
steps:
28+
- name: Create puzzle issue
29+
id: create-issue
30+
run: |
31+
ISSUE_URL=$(gh issue create \
32+
--title "Advent of code - ${{ inputs.year }} day ${{ inputs.day }} part ${{ inputs.part }}" \
33+
--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")
34+
echo "issue_url=${ISSUE_URL}" >> $GITHUB_OUTPUT
35+
36+
- name: Add sourcery comment
37+
run: |
38+
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\`"
39+
env:
40+
ISSUE_URL: ${{ steps.create-issue.outputs.issue_url }}

0 commit comments

Comments
 (0)