This guide will help you quickly configure a new repository from this template for the current year's Advent of Code.
❗ IMPORTANT: Template Maintenance
Before starting the setup: Ensure the Maintenance Tasks section is completed on the template repository to guarantee that all dependencies are up-to-date.
- Open the main page of the template repository.
- Click Use this template and then Create a new repository.
- Name the new repository (e.g.,
advent-of-code-202X).
You need to set up two tokens: the GitHub token (PAT_TOKEN) and the Codacy token (CODACY_PROJECT_TOKEN).
The PAT_TOKEN is necessary for GitHub Actions (like Dependabot and year update) to function correctly.
- Verify/Create the PAT:
- Go to Personal access tokens (classic).
- If you don't have a token named
PAT_TOKEN(or similar), click Generate New Token, select thereposcope, and copy the generated token. - If an existing
PAT_TOKENis close to expiring, click on it, select regenerate the token, and copy the new value.
- Add the PAT to the new repository:
- Go to Settings / Secrets and variables / Actions.
- Create a new repository secret: Name:
PAT_TOKEN, Secret: [Your Token]
Required to send code coverage reports.
- Get the Codacy Token:
- Go to Codacy and add your new repository.
- Open Settings / Coverage and copy the
CODACY_PROJECT_TOKENvalue.
- Add the Secret (x2): You need to add the token in two locations.
- Actions: Go to Settings / Secrets and variables / Actions.
- Create a new secret: Name:
CODACY_PROJECT_TOKEN, Secret: [Codacy Token]
- Create a new secret: Name:
- Dependabot: Go to Settings / Secrets and variables / Dependabot secrets.
- Create a new secret: Name:
CODACY_PROJECT_TOKEN, Secret: [Codacy Token]
- Create a new secret: Name:
- Actions: Go to Settings / Secrets and variables / Actions.
💡 Note: Setting the secret for Dependabot is crucial to prevent automated Pull Requests from failing the coverage report job.
- Configure Workflow Permissions:
- Go to Settings / Actions / General.
- Under Workflow permissions, enable:
- Read and write permissions.
- Allow GitHub Actions to create and approve pull requests.
- Run "Update year" Workflow:
- Go to the Actions tab and open the Update year workflow.
- Click Run workflow, type the year in
yyyyformat (e.g.,2025), and Run workflow.
- Merge the Pull Request:
- The workflow will automatically create a Pull Request.
- Open it, verify the year changes are correct, and merge it.
After merging, the repository description, topics, and all
README.mdandpom.xmlfiles will be updated with the correct year.
To privately manage your input files for each day.
- Create Data Repository:
- Create a private repository using the advent-of-code-yyyy-data template.
- Add as a Submodule:
git clone https://github.com/Flashky/advent-of-code-{year}.git &&
cd advent-of-code-{year} &&
git submodule add -b master https://github.com/Flashky/advent-of-code-{year}-data.git src/test/resources/inputs &&
git push- Go to Codacy and open your repository.
- Open Settings / General and copy both the
code qualityandcoveragebadges. - Add them to this
README.md(replace or add to the top).
- Remove all these setup instructions from the
README.md. - Commit and push the changes.
Enjoy your new Advent of Code edition!
⚠️ These steps should be performed on the original template repository before creating the new repository.
- Go to the dependency graph.
- Manually run the following jobs:
pom.xmland.github/workflows/build-report.yml. - Review and merge any pending pull requests.
- Day 1
- Day 2
- Day 3
- Day 4
- Day 5
- Day 6
- Day 7
- Day 8
- Day 9
- Day 10
- Day 11
- Day 12
- Day 13
- Day 14
- Day 15
- Day 16
- Day 17
- Day 18
- Day 19
- Day 20
- Day 21
- Day 22
- Day 23
- Day 24
- Day 25
Without data repository:
git clone https://github.com/Flashky/advent-of-code-{year}.gitIncluding data repository:
git clone https://github.com/Flashky/advent-of-code-{year}.git --recurse-submodules