Skip to content

Commit 5d9baf2

Browse files
authored
Initial commit
0 parents  commit 5d9baf2

20 files changed

+917
-0
lines changed

.github/readme/cover.png

66.6 KB
Loading

.github/readme/livestream.png

3.34 MB
Loading

.github/readme/run.png

35.6 KB
Loading

.github/template-cleanup/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# %NAME%
2+
3+
Welcome to the Advent of Code[^aoc] Kotlin project created by [%ACTOR%][github] using the [Advent of Code Kotlin Template][template] delivered by JetBrains.
4+
5+
In this repository, %ACTOR% is about to provide solutions for the puzzles using [Kotlin][kotlin] language.
6+
7+
If you're stuck with Kotlin-specific questions or anything related to this template, check out the following resources:
8+
9+
- [Kotlin docs][docs]
10+
- [Kotlin Slack][slack]
11+
- Template [issue tracker][issues]
12+
13+
14+
[^aoc]:
15+
[Advent of Code][aoc] – An annual event of Christmas-oriented programming challenges started December 2015.
16+
Every year since then, beginning on the first day of December, a programming puzzle is published every day for twenty-five days.
17+
You can solve the puzzle and provide an answer using the language of your choice.
18+
19+
[aoc]: https://adventofcode.com
20+
[docs]: https://kotlinlang.org/docs/home.html
21+
[github]: https://github.com/%ACTOR%
22+
[issues]: https://github.com/kotlin-hands-on/advent-of-code-kotlin-template/issues
23+
[kotlin]: https://kotlinlang.org
24+
[slack]: https://surveys.jetbrains.com/s3/kotlin-slack-sign-up
25+
[template]: https://github.com/kotlin-hands-on/advent-of-code-kotlin-template
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
rootProject.name = "%NAME%"
2+
3+
dependencyResolutionManagement {
4+
repositories {
5+
mavenCentral()
6+
}
7+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# GitHub Actions Workflow responsible for cleaning up the Advent of Code Kotlin Template repository from
2+
# the template-specific files and configurations. This workflow is supposed to be triggered automatically
3+
# when a new template-based repository has been created.
4+
5+
name: Template Cleanup
6+
on:
7+
push:
8+
branches: [main]
9+
10+
jobs:
11+
12+
# Run cleaning process only if workflow is triggered by the non-"advent-of-code-kotlin-template" repository.
13+
template-cleanup:
14+
name: Template Cleanup
15+
runs-on: ubuntu-latest
16+
if: github.event.repository.name != 'advent-of-code-kotlin-template'
17+
permissions:
18+
contents: write
19+
steps:
20+
21+
# Check out current repository
22+
- name: Fetch Sources
23+
uses: actions/checkout@v4
24+
25+
# Cleanup project
26+
- name: Cleanup
27+
run: |
28+
export LC_CTYPE=C
29+
export LANG=C
30+
31+
# Prepare variables
32+
NAME="${GITHUB_REPOSITORY##*/}"
33+
ACTOR=$(echo $GITHUB_ACTOR | tr '[:upper:]' '[:lower:]')
34+
SAFE_NAME=$(echo $NAME | sed 's/[^a-zA-Z0-9]//g' | tr '[:upper:]' '[:lower:]')
35+
SAFE_ACTOR=$(echo $ACTOR | sed 's/[^a-zA-Z0-9]//g' | tr '[:upper:]' '[:lower:]')
36+
GROUP="com.github.$SAFE_ACTOR.$SAFE_NAME"
37+
38+
# Replace placeholders in the template-cleanup files
39+
sed -i "s/%ACTOR%/$ACTOR/g" .github/template-cleanup/*
40+
sed -i "s/%NAME%/$NAME/g" .github/template-cleanup/*
41+
sed -i "s/%REPOSITORY%/${GITHUB_REPOSITORY/\//\\/}/g" .github/template-cleanup/*
42+
sed -i "s/%GROUP%/$GROUP/g" .github/template-cleanup/*
43+
44+
# Move content
45+
cp -R .github/template-cleanup/* .
46+
47+
# Cleanup
48+
rm -rf \
49+
.github/readme \
50+
.github/template-cleanup \
51+
.github/workflows/template-cleanup.yml \
52+
LICENSE
53+
54+
# Remove leftover empty directories
55+
find . -type d -empty -delete
56+
57+
# Commit modified files
58+
- name: Commit files
59+
run: |
60+
git config --local user.email "[email protected]"
61+
git config --local user.name "GitHub Action"
62+
git add .
63+
git commit -m "Template cleanup"
64+
65+
# Push changes
66+
- name: Push changes
67+
uses: ad-m/github-push-action@master
68+
with:
69+
branch: main
70+
github_token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.gradle
2+
.idea
3+
.kotlin/
4+
build
5+
src/**/*.txt
6+
local.properties

.idea/file.template.settings.xml

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/fileTemplates/Advent of Code.kt

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/fileTemplates/Advent of Code.kt.child.0.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)