-
Notifications
You must be signed in to change notification settings - Fork 1
merge walker #13
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
Closed
Closed
merge walker #13
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
3f875c2
Merge pull request #7 from sourcery-ai/sourcery-ai/issue-1
brendanator 73525f3
feat: Implement Advent of Code CLI
sourcery-ai[bot] 7581399
Address review by @brendanator
sourcery-ai[bot] a5f742b
Merge pull request #8 from sourcery-ai/sourcery-ai/issue-2
brendanator 6835738
CI: Auto-merge Sourcery AI bot PRs (#9)
sourcery-ai[bot] 38a3a88
CI: Add workflow to create Advent of Code puzzle issues (#10)
sourcery-ai[bot] 7f682d7
Add workflow to submit Advent of Code solutions (#12)
sourcery-ai[bot] ce26e94
Integrate code into GitHub project
JohnDaWalka daf4bb2
Merge pull request #1 from JohnDaWalka/integrate-code
JohnDaWalka 83d2870
Update README.md
JohnDaWalka 6849db6
e496043
Add `actions/checkout@v4` step and update `GH_TOKEN` in GitHub workflows
JohnDaWalka 2a720cb
Add steps to merge `develop` into `main` branch in GitHub Actions wor…
JohnDaWalka 6c8fe55
Add Poker Coach UI implementation and tests
JohnDaWalka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
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.GH_TOKEN }} | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- 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 }} | ||
|
||
- name: Merge develop into main | ||
run: | | ||
git fetch origin | ||
git checkout main | ||
git merge develop | ||
gh pr merge --squash --auto --delete-branch |
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Merge Repos | ||
|
||
on: | ||
repository_dispatch: | ||
types: [merge-repos] | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
merge-repos: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out target repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ github.event.client_payload.target_repo }} | ||
token: ${{ secrets.GH_TOKEN }} | ||
|
||
- name: Merge source repository | ||
run: | | ||
git remote add source https://github.com/${{ github.event.client_payload.source_repo }}.git | ||
git fetch source | ||
git merge source/main --allow-unrelated-histories | ||
|
||
- name: Push changes to target repository | ||
run: | | ||
git push origin main |
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Auto-merge Sourcery AI Bot PRs | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
permissions: | ||
contents: write | ||
|
||
env: | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
|
||
jobs: | ||
merge-sourcery-pr: | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.user.login == 'sourcery-ai[bot]' | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Merge Pull Request | ||
run: | | ||
gh pr merge "${{ github.event.pull_request.number }}" \ | ||
--squash \ | ||
--auto \ | ||
--delete-branch \ | ||
--repo "${{ github.repository }}" | ||
|
||
- name: Merge develop into main | ||
run: | | ||
git fetch origin | ||
git checkout main | ||
git merge develop | ||
gh pr merge --squash --auto --delete-branch |
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: Submit Advent of Code Solution | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'puzzles/year_*/day_*/answer_part*.txt' | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
issues: write | ||
repository-dispatch: write | ||
|
||
env: | ||
AOC_SESSION: ${{ secrets.AOC_SESSION }} | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
|
||
jobs: | ||
submit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up uv | ||
uses: astral-sh/setup-uv@v4 | ||
|
||
- name: Install dependencies | ||
run: uv sync | ||
|
||
- name: Get changed files | ||
id: changed-files | ||
uses: tj-actions/changed-files@v42 | ||
with: | ||
files: puzzles/year_*/day_*/answer_part*.txt | ||
|
||
- name: Extract year, day and part from filename | ||
id: extract-info | ||
run: | | ||
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | ||
echo "No file changes to process" | ||
exit 0 | ||
fi | ||
|
||
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do | ||
if [[ $file =~ puzzles/year_([0-9]+)/day_([0-9]+)/answer_part([12]).txt ]]; then | ||
echo "year=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT | ||
echo "day=${BASH_REMATCH[2]}" >> $GITHUB_OUTPUT | ||
echo "part=${BASH_REMATCH[3]}" >> $GITHUB_OUTPUT | ||
fi | ||
done | ||
|
||
- name: Submit solution | ||
id: submit | ||
if: steps.extract-info.outputs.year != '' | ||
continue-on-error: true | ||
run: | | ||
output=$(uv run advent_of_code.py submit ${{ steps.extract-info.outputs.year }} ${{ steps.extract-info.outputs.day }} ${{ steps.extract-info.outputs.part }}) | ||
echo "submission_result=$output" >> $GITHUB_OUTPUT | ||
|
||
- name: Update results in README | ||
if: steps.extract-info.outputs.year != '' | ||
run: uv run advent_of_code.py update-results ${{ steps.extract-info.outputs.year }} | ||
|
||
- name: Download part 2 if part 1 was correct | ||
id: download-part2 | ||
if: steps.extract-info.outputs.part == '1' && steps.submit.outcome == 'success' | ||
run: | | ||
file_path=$(uv run advent_of_code.py download ${{ steps.extract-info.outputs.year }} ${{ steps.extract-info.outputs.day }}) | ||
echo "file_path=$file_path" >> $GITHUB_OUTPUT | ||
|
||
- name: Configure Git | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
|
||
- name: Commit and push changes | ||
run: | | ||
git add puzzles/year_${{ steps.extract-info.outputs.year }}/day_${{ steps.extract-info.outputs.day }} | ||
git add README.md | ||
git commit -m "Update puzzle files for year ${{ steps.extract-info.outputs.year }} day ${{ steps.extract-info.outputs.day }}" | ||
git push | ||
|
||
- name: Trigger create-puzzle-issue workflow | ||
if: steps.download-part2.outputs.file_path != '' | ||
uses: peter-evans/repository-dispatch@v2 | ||
with: | ||
token: ${{ env.GH_TOKEN }} | ||
event-type: create-puzzle-issue | ||
client-payload: '{"year": "${{ steps.extract-info.outputs.year }}", "day": "${{ steps.extract-info.outputs.day }}", "part": "2"}' | ||
|
||
- name: Merge develop into main | ||
run: | | ||
git fetch origin | ||
git checkout main | ||
git merge develop | ||
gh pr merge --squash --auto --delete-branch |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.