Skip to content

Commit 29ccc0d

Browse files
authored
Merge pull request #123 from Flashky/feature/refactor_readme
Feature/refactor readme
2 parents 9ef7d15 + 7a70854 commit 29ccc0d

File tree

1 file changed

+71
-72
lines changed

1 file changed

+71
-72
lines changed

README.md

Lines changed: 71 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,75 @@
1-
# Advent of Code {year}
1+
# 🎄 Advent of Code {year}
22

3-
## Housekeeping
3+
## ⚙️ Setup Guide
44

5-
Before creating a new repository from this template, perform the following steps.
5+
This guide will help you quickly configure a new repository from this template for the current year's Advent of Code.
66

7-
### Personal Access Token Setup
7+
> **❗ IMPORTANT: Template Maintenance**
8+
>
9+
> **Before starting the setup:** Ensure the **[Maintenance Tasks](#maintenance-tasks)** section is completed on the **template repository** to guarantee that all dependencies are up-to-date.
810
9-
Open **[Personal access tokens (classic)](https://github.com/settings/tokens)** settings and verify if there is any
10-
``PAT_TOKEN`` or if it is nearly to expire.
11-
12-
#### Creation of a new token
13-
14-
If there is no ``PAT_TOKEN`` created:
15-
16-
1. Click on **Generate New Token**.
17-
2. Select ``repo`` checkbox.
18-
3. Copy the token.
19-
20-
#### Refresh of an existing token
21-
22-
If there is an existing ``PAT_TOKEN``:
23-
24-
1. Click on it.
25-
2. If the expiration date is due soon, click on **regenerate the token**.
26-
3. Update the ``PAT_TOKEN`` at this template repository.
27-
28-
### Update dependencies
11+
---
2912

30-
Open [dependency graph](https://github.com/Flashky/advent-of-code-yyyy/network/updates) settings
31-
and manually run the following jobs:
13+
### 🚀 1. New Repository Creation
3214

33-
- ``pom.xml``
34-
- ``.github/workflows/build-report.yml``
15+
1. Open the main page of the [template repository](https://github.com/Flashky/advent-of-code-yyyy).
16+
2. Click **Use this template** and then **Create a new repository**.
17+
3. Name the new repository (e.g., `advent-of-code-202X`).
3518

36-
Review and merge any pending pull requests.
19+
### 🔑 2. Token and Secret Configuration
3720

38-
## New repository creation
21+
You need to set up two tokens: the **GitHub** token (`PAT_TOKEN`) and the **Codacy** token (`CODACY_PROJECT_TOKEN`).
3922

40-
Follow this steps after housekeeping is finished.
23+
#### A. 🐙 Personal Access Token (PAT)
4124

42-
### Creation
25+
The `PAT_TOKEN` is necessary for GitHub Actions (like Dependabot and year update) to function correctly.
4326

44-
1. Open the main page of the [template repository](https://github.com/Flashky/advent-of-code-yyyy).
45-
2. Click on **Use this template**.
46-
3. Select **Create a new repository**:
47-
1. Give a name to the new repository. Example: ``advent-of-code-2022``.
27+
1. **Verify/Create the PAT:**
28+
* Go to **[Personal access tokens (classic)](https://github.com/settings/tokens)**.
29+
* If you don't have a token named `PAT_TOKEN` (or similar), click **Generate New Token**, select the `repo` scope, and **copy the generated token**.
30+
* If an existing `PAT_TOKEN` is close to expiring, click on it, select **regenerate the token**, and **copy the new value**.
31+
2. **Add the PAT to the new repository:**
32+
* Go to **Settings / Secrets and variables / Actions**.
33+
* Create a new repository secret: **Name:** `PAT_TOKEN`, **Secret:** *\[Your Token]*
4834

49-
### Personal Access Token Setup
35+
#### B. 🛡️ Codacy Project Token
5036

51-
Add the previously mentioned ``PAT_TOKEN`` to this new repository.
37+
Required to send code coverage reports.
5238

53-
### Codacy Project Token Setup
39+
1. **Get the Codacy Token:**
40+
* Go to [Codacy](https://app.codacy.com) and **add your new repository**.
41+
* Open **Settings / Coverage** and **copy** the `CODACY_PROJECT_TOKEN` value.
42+
2. **Add the Secret (x2):** You need to add the token in **two** locations.
43+
* **Actions:** Go to **Settings / Secrets and variables / Actions**.
44+
* Create a new secret: **Name:** `CODACY_PROJECT_TOKEN`, **Secret:** *\[Codacy Token]*
45+
* **Dependabot:** Go to **Settings / Secrets and variables / Dependabot secrets**.
46+
* Create a new secret: **Name:** `CODACY_PROJECT_TOKEN`, **Secret:** *\[Codacy Token]*
5447

55-
1. Go to [Codacy](https://app.codacy.com) and add the repository.
56-
2. Open **Settings / Coverage** and copy the ``CODACY_PROJECT_TOKEN`` value.
57-
3. Open the created repository.
58-
5. Open **Settings / Secrets and variables / Actions** and click on **New repository secret**:
59-
1. **Name:** ``CODACY_PROJECT_TOKEN``
60-
2. **Secret:** The previously copied token.
61-
6. Open **Settings / Secrets and variables / Dependabot secrets** and click on **New repository secret**:
62-
1. **Name:** ``CODACY_PROJECT_TOKEN``
63-
2. **Secret:** The previously copied token.
48+
> 💡 **Note:** Setting the secret for Dependabot is crucial to prevent automated Pull Requests from failing the coverage report job.
6449
65-
Dependabot secrets are used on Dependabot Pull Requests. Not setting up the ``CODACY_PROJECT_TOKEN`` will result in failing the sending coverage report to Codacy step job of the build.
50+
### 📅 3. Year Update and Permissions
6651

67-
### Update repository information
52+
1. **Configure Workflow Permissions:**
53+
* Go to **Settings / Actions / General**.
54+
* Under **Workflow permissions**, enable:
55+
* **Read and write permissions**.
56+
* **Allow GitHub Actions to create and approve pull requests**.
57+
2. **Run "Update year" Workflow:**
58+
* Go to the **Actions** tab and open the **Update year** workflow.
59+
* Click **Run workflow**, type the **year** in `yyyy` format (e.g., `2025`), and **Run workflow**.
60+
3. **Merge the Pull Request:**
61+
* The workflow will automatically create a Pull Request.
62+
* **Open it**, verify the year changes are correct, and **merge** it.
6863

69-
1. Go to **Settings / Actions / General**.
70-
2. Under **Workflow permissions**:
71-
1. Enable **Read and write permissions**.
72-
2. Enable **Allow GitHub Actions to create and approve pull requests**.
73-
4. Go to **Actions** and open the **Update year** workflow:
74-
1. Click on **Run workflow**.
75-
2. Type the year in ``yyyy`` format and click on **Run workflow**.
64+
> After merging, the repository description, topics, and all `README.md` and `pom.xml` files will be updated with the correct year.
7665
77-
After the workflow has ended a Pull Request will be created:
78-
1. Open the **pull request**.
79-
2. Verify everything is right and then **merge** it.
80-
81-
After the PR is merged the repository will have its description and topics updated. Also, all ``README.md`` and ``pom.xml`` will be updated with current year value. The PR can be declined and workflow can be executed again if there was any problem that needed a fix.
66+
### 💾 4. Data Repository Setup
8267

83-
### Data Repository Setup
68+
To privately manage your input files for each day.
8469

85-
1. Create a private data repository using [advent-of-code-yyyy-data](https://github.com/Flashky/advent-of-code-yyyy-data) template repository and set it up.
86-
2. Add the data repository as a [submodule](https://github.blog/2016-02-01-working-with-submodules/) using the command:
70+
1. **Create Data Repository:**
71+
* Create a **private** repository using the [advent-of-code-yyyy-data](https://github.com/Flashky/advent-of-code-yyyy-data) template.
72+
2. **Add as a [Submodule](https://github.blog/2016-02-01-working-with-submodules/):**
8773

8874
```bash
8975
git clone https://github.com/Flashky/advent-of-code-{year}.git &&
@@ -92,21 +78,34 @@ git submodule add -b master https://github.com/Flashky/advent-of-code-{year}-dat
9278
git push
9379
```
9480

95-
### Codacy Badges Setup
81+
### 🏆 5. Codacy Badges
9682

97-
1. Go to [Codacy](https://app.codacy.com) and open the repository.
98-
2. Open **Settings / General** and copy both the ``code quality`` and ``coverage`` badges.
99-
3. Add them to this ``README.md``.
83+
1. Go to [Codacy](https://app.codacy.com) and open your repository.
84+
2. Open **Settings / General** and **copy** both the `code quality` and `coverage` badges.
85+
3. **Add them** to this `README.md` (replace or add to the top).
10086

101-
### Almost done...
87+
### ✅ 6. Final Steps
10288

103-
1. Remove these instructions from ``README.md``.
104-
2. Push the changes and...
89+
1. **Remove all these setup instructions** from the `README.md`.
90+
2. **Commit and push** the changes.
10591

10692
**Enjoy your new Advent of Code edition!**
10793

10894
---
10995

96+
<a name="maintenance-tasks"></a>
97+
## 🛠️ Maintenance Tasks
98+
99+
> ⚠️ These steps should be performed on the original **template repository** before creating the new repository.
100+
101+
### Update Dependencies
102+
103+
* Go to the [dependency graph](https://github.com/Flashky/advent-of-code-yyyy/network/updates).
104+
* Manually run the following jobs: **`pom.xml`** and **`.github/workflows/build-report.yml`**.
105+
* Review and merge any pending pull requests.
106+
107+
---
108+
110109
- [Day 1](https://github.com/Flashky/advent-of-code-{year}/tree/master/src/main/java/com/adventofcode/flashk/day01)
111110
- [Day 2](https://github.com/Flashky/advent-of-code-{year}/tree/master/src/main/java/com/adventofcode/flashk/day02)
112111
- [Day 3](https://github.com/Flashky/advent-of-code-{year}/tree/master/src/main/java/com/adventofcode/flashk/day03)

0 commit comments

Comments
 (0)