{"id":22637790,"url":"https://github.com/Viinyard/adventofcode-template","last_synced_at":"2025-08-06T02:34:10.367Z","repository":{"id":266749699,"uuid":"899245210","full_name":"Viinyard/adventofcode-template","owner":"Viinyard","description":"Java template project to get started with Advent of Code with automatic generation of code skeleton for each solution","archived":false,"fork":false,"pushed_at":"2024-12-05T22:41:25.000Z","size":35,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-05T23:22:08.995Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Viinyard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-05T22:08:47.000Z","updated_at":"2024-12-05T22:52:00.000Z","dependencies_parsed_at":"2024-12-05T23:33:08.520Z","dependency_job_id":null,"html_url":"https://github.com/Viinyard/adventofcode-template","commit_stats":null,"previous_names":["viinyard/adventofcode-template"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Viinyard%2Fadventofcode-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Viinyard%2Fadventofcode-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Viinyard%2Fadventofcode-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Viinyard%2Fadventofcode-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Viinyard","download_url":"https://codeload.github.com/Viinyard/adventofcode-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228830727,"owners_count":17978342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-09T04:01:03.124Z","updated_at":"2024-12-09T04:02:36.931Z","avatar_url":"https://github.com/Viinyard.png","language":"Java","funding_links":[],"categories":["Project Templates"],"sub_categories":[],"readme":"# Advent Of Code Template\n\n\n## Prerequisites\n\n- [Java 21](https://www.oracle.com/java/technologies/downloads/#java21)\n- [Maven 3.9.9](https://maven.apache.org/download.cgi)\n\n## Build\n\nClic on [`Use this template`](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template#creating-a-repository-from-a-template) and clone the repository.\n\nThen, build the project with the following command:\n\n```shell\n  mvn clean install\n```\n\n## Setting up the project\n\n### Customize the project\n\nIf you want to customize the project, and change the group id for example, you can change group id in the pom.xml file:\n\n```xml\n  \u003cgroupId\u003edev.vinyard.adventofcode\u003c/groupId\u003e\n```\nIf you do this you also need to change the package name in the BluePrinter environment.xml file to keep it working:\n\n```xml\n  \u003cproperty key=\"PACKAGE\"\u003edev/vinyard/adventofcode\u003c/property\u003e\n```\nAll the generated files will be created in the new package.\n\n### Setting up the environment\n\nTo get the Advent of Cope scrapper plugin to work, you need to set up your session id :\n\nYou can set your session id in your environment variables:\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eHow to get my session id\u003c/b\u003e\u003c/summary\u003e\n\n1. Go to the [Advent of Code](https://adventofcode.com/) website.\n2. Connect to your account.\n3. Open the developer tools of your browser.\n4. Go to the `Application` tab.\n5. In the `Cookies` section, you will find a cookie named `session`.\n6. Copy the value of the cookie.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eShow instruction for Linux or macOS\u003c/b\u003e\u003c/summary\u003e\n\n```shell\n  export AOC_SESSION_ID=your_session_id\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eShow instruction for Windows\u003c/b\u003e\u003c/summary\u003e\n\nYou have to go to the environment variables and add a new one with the name `AOC_SESSION_ID` and the value `your_session_id`.\n\n\u003c/details\u003e\n\nOr you can set it in the BluePrinter environment.xml file:\n\n```xml\n  \u003cproperty key=\"SESSION_ID\"\u003eyour_session_id\u003c/property\u003e\n```\n\n\u003e [!CAUTION]\n\u003e Be careful not to share your session id with anyone, don't commit it in your repository.\n\n### Configure your repository\n\n1. Allow github action to create pull requests on your repository:\n   - Go to your repository settings.\n   - Go to the `Actions` tab.\n   - Go to the `General` section.\n   - Check the `Workflow permissions` checkbox.\n     - Check `Read and write permissions`\n     - Check `Allow GitHub Actions to create and approve pull requests`\n\n2. Add your session_id in your secrets:\n   - Go to your repository settings.\n   - Go to the `Secrets and variables` tab.\n   - Go to the `Actions` section.\n   - Clic on `New repository secret`.\n   - Add a new secret with the name `AOC_SESSION_ID` and the value `your_session_id`.\n\n3. Create a Personal Access Token (PAT) for the workflow:\n   - Fine-grained [Personal Access Token (PAT)](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) with `contents: write` and `pull-requests: write` scopes.\n   - Go to your account settings.\n   - Go to the `Developer settings` tab.\n   - Go to the `Personal access tokens` section.\n   - Go to the `Fine-grained token` section.\n   - Create a new token with the `contents: write` and `pull-requests: write` scopes and copy the token.\n   - Go to your repository settings.\n   - Go to the `Secrets and variables` tab.\n   - Go to the `Actions` section.\n   - Clic on `New repository secret`.\n   - Add a new secret with the name `PAT` and the value `your_personal_access_token`.\n\nThat's it, you are ready to generate your solutions with Github Actions. Solutions will be generated in a brand new branch and a pull request will be created.\n\n## How to use\n\n### Generate a solution\n\nTo generate the next solution of the year for Advent of Code, run the following command:\n\n```shell\n  mvn blueprinter:blueprint@next-solution \n```\n\nTo generate a specific solution for Advent of Code, run the following command:\n\n```shell\n  mvn blueprinter:blueprint@solution -Dyear=2023 -Dday=1 -Dpart=1\n```\n\n\u003e [!IMPORTANT]\n\u003e To generate a new pull request with the solution, you need to have your GitHub environment set up\n\n1. On your repository, go to the `Actions` tab.\n2. Go to the `All workflows` section.\n\nYou will see 3 workflows:\n- `Generate antlr4 based Solution of the Day` : This workflow generates the solution for today's day.\n- `Generate Next antlr4 based Solution` : This workflow generates the next unimplemented solution of the year. If you haven't implemented any solution yet, it will generate the first one.\n- `Maven Build` : This workflow builds the project, generates the README.md file, and pushes the changes to the repository.\n\n## Getting started\n\nOnce you have generated the solution, you can implement the code in the generated files.\n\n1. You can find the antlr4 grammar in the `src/main/antlr4` directory.\n2. You can find the solution in the `src/main/java` directory\n   - You have one ASD file for the antlr4 grammar for the day\n   - And one solution file for each part of the day.\n3. Go to the `src/test/java` directory to initialize the first test result.\n4. The first test from the `test.txt` is not automatically generated, you need to copy it from the Advent of Code website and paste it in the second argument of the `testSolution` method in the test file.\n5. You can run the tests, and begin to implement the solution until all tests pass.\n6. Once the first test passes, you can try to paste the result of the second test as your puzzle answer in the advent of code website.\n7. Don't forget to paste it in the expected result of the second test in the test file.\n8. Now you can refactor your code to make it more efficient, and run the tests to check if everything is still working.\n9. Push your changes to your repository, and the workflow will generate the README.md file with the result of the tests and benchmarks.\n\n\u003e [!IMPORTANT]\n\u003e Automated generation of the README.md is disabled by default, because it erase the actual content of the README.md file.\n\u003e You can enable it by uncomment the `on:` section in the `.github/workflows/build.yml` file.\n\n```yaml\non: \n   pull_request:\n   push:\n     branches:\n       - master\n```\n\n\u003e [!TIP]\n\u003e You can find a lot of examples of resolved solutions in my repository [adventofcode](https://github.com/Viinyard/adventofcode).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FViinyard%2Fadventofcode-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FViinyard%2Fadventofcode-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FViinyard%2Fadventofcode-template/lists"}