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

Pull request to resolve #1 #259

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
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
12 changes: 8 additions & 4 deletions .github/workflows/auto-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ jobs:
open-pull-request:
runs-on: ubuntu-latest
steps:
- name: get issue number
- name: Checkout
uses: actions/checkout@v4

- name: Get issue number
id: get_issue_number
run: |
if [[ ${{ github.ref_name }} =~ puzzle/([0-9]{4})-day-([1-9]|1[0-9]|2[0-5]) ]]; then
year=${BASH_REMATCH[1]}
day=${BASH_REMATCH[2]}

issue_number=$(gh issue list -S '[$year] [Day $day] in:title' --json number | jq '.[].number')
issue_number=$(gh issue list -S "[$year] [Day $day] in:title" --json number | jq '.[].number')

if [ -z "$issue_number" ]; then
echo "::error::Issue not found!"
Expand All @@ -30,7 +33,8 @@ jobs:
fi
env:
GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }}
- name: create pull request
run: gh pr create -B ${{ GITHUB_DEFAULT_BRANCH }} -H ${{ github.ref_name }} --title 'Pull request to resolve #${{ steps.get_issue_number.outputs.issue_number }}'
- name: Create pull request
run: |
gh pr create -B main -H ${{ github.ref_name }} -t "Pull request to resolve #${{ steps.get_issue_number.outputs.issue_number }}" -b ""
env:
GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }}
4 changes: 3 additions & 1 deletion .github/workflows/check-resolution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ jobs:
else
echo "Branch name does not follow the expected pattern."
exit 1
fi

- name: Get answer
id: get_answer
run: |
year="${{ steps.extract.outputs.year }}"
day="${{ steps.extract.outputs.day }}"

script_path="puzzles/$year/day $day/resolution.py"
script_path="puzzles/$year/day-$day/resolution.py"

if [ -f "$script_path" ]; then
echo "Running script: $script_path"
Expand All @@ -50,6 +51,7 @@ jobs:
else
echo "Script not found: $script_path"
exit 1
fi

- name: Submit answer
id: submit_answer
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/update-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,32 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Parsing issue
id: issue-parser
uses: stefanbuck/github-issue-parser@v3
with:
template-path: .github/ISSUE_TEMPLATE/puzzle.yml

- name: Adding milestone to issue
uses: Julexar/[email protected]
with:
token: "${{ secrets.ACTION_TOKEN }}"
milestone: "${{ steps.issue-parser.outputs.issueparser_puzzle-year }} Puzzles"

- name: Run bash script to extract day from issue title
id: extract
run: |
title="${{ github.event.issue.title }}"

if [[ $title =~ Day\ ([0-9]+) ]]; then
day=${BASH_REMATCH[1]}
echo "day=${day}" >> $GITHUB_OUTPUT
else
echo "::error::Title does not match the expected pattern"
exit 1
fi

- name: Create comment
uses: peter-evans/create-or-update-comment@v4
with:
Expand Down
Empty file removed puzzles/2015/day 1/.keep
Empty file.
2 changes: 2 additions & 0 deletions puzzles/2015/day-1/resolution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def main():
print("Hello world!")
Loading