Skip to content

Commit e2950ae

Browse files
committed
chore: initial commit と༼ ◕_◕ と ༽
0 parents  commit e2950ae

870 files changed

Lines changed: 489537 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/test.yml

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
lint-and-test:
11+
runs-on: ubuntu-latest
12+
name: Lint, Format & Unit Test
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: "24"
19+
cache: "npm"
20+
- run: npm ci
21+
22+
# Run code quality checks
23+
- run: npm run format:check
24+
- run: npm run lint
25+
- run: npm run typecheck
26+
27+
# Run unit tests
28+
- run: npm test
29+
30+
# Build the action
31+
- run: npm run build
32+
33+
integration-test:
34+
runs-on: ubuntu-latest
35+
name: Integration Tests
36+
needs: lint-and-test
37+
38+
steps:
39+
- uses: actions/checkout@v4
40+
- uses: actions/setup-node@v4
41+
with:
42+
node-version: "20"
43+
cache: "npm"
44+
- run: npm ci
45+
- run: npm run build
46+
47+
- name: Test auto-detect PR number
48+
id: auto
49+
uses: ./
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
53+
- name: Validate auto-detected result
54+
run: |
55+
if [ -z "${{ steps.auto.outputs.number }}" ]; then
56+
echo "❌ Error: No number output from auto-detect test"
57+
exit 1
58+
fi
59+
if [ -z "${{ steps.auto.outputs.codename }}" ]; then
60+
echo "❌ Error: No codename output from auto-detect test"
61+
exit 1
62+
fi
63+
echo "✅ Auto-detect test passed:"
64+
echo " PR Number: ${{ steps.auto.outputs.number }}"
65+
echo " Codename: ${{ steps.auto.outputs.codename }}"
66+
67+
- name: Test explicit number
68+
id: explicit
69+
uses: ./
70+
with:
71+
number: 123
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
75+
- name: Validate explicit result
76+
run: |
77+
if [ "${{ steps.explicit.outputs.number }}" != "123" ]; then
78+
echo "❌ Error: Expected number 123, got ${{ steps.explicit.outputs.number }}"
79+
exit 1
80+
fi
81+
if [ -z "${{ steps.explicit.outputs.codename }}" ]; then
82+
echo "❌ Error: No codename output from explicit test"
83+
exit 1
84+
fi
85+
echo "✅ Explicit number test passed:"
86+
echo " Number: ${{ steps.explicit.outputs.number }}"
87+
echo " Codename: ${{ steps.explicit.outputs.codename }}"
88+
89+
- name: Test with template
90+
id: template
91+
uses: ./
92+
with:
93+
number: 456
94+
template: "env-{codename}-{number}"
95+
env:
96+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97+
98+
- name: Validate template result
99+
run: |
100+
if [ "${{ steps.template.outputs.number }}" != "456" ]; then
101+
echo "❌ Error: Expected number 456, got ${{ steps.template.outputs.number }}"
102+
exit 1
103+
fi
104+
if [ -z "${{ steps.template.outputs.codename }}" ]; then
105+
echo "❌ Error: No codename output from template test"
106+
exit 1
107+
fi
108+
if [ -z "${{ steps.template.outputs.formatted }}" ]; then
109+
echo "❌ Error: No formatted output from template test"
110+
exit 1
111+
fi
112+
# Check that formatted output contains expected pattern
113+
if [[ ! "${{ steps.template.outputs.formatted }}" =~ ^env-.*-456$ ]]; then
114+
echo "❌ Error: Formatted output doesn't match expected pattern 'env-{codename}-456'"
115+
echo " Got: ${{ steps.template.outputs.formatted }}"
116+
exit 1
117+
fi
118+
echo "✅ Template test passed:"
119+
echo " Number: ${{ steps.template.outputs.number }}"
120+
echo " Codename: ${{ steps.template.outputs.codename }}"
121+
echo " Formatted: ${{ steps.template.outputs.formatted }}"
122+
123+
- name: Test deterministic behavior
124+
id: deterministic1
125+
uses: ./
126+
with:
127+
number: 999
128+
env:
129+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130+
131+
- name: Test deterministic behavior (repeat)
132+
id: deterministic2
133+
uses: ./
134+
with:
135+
number: 999
136+
env:
137+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
138+
139+
- name: Validate deterministic behavior
140+
run: |
141+
if [ "${{ steps.deterministic1.outputs.codename }}" != "${{ steps.deterministic2.outputs.codename }}" ]; then
142+
echo "❌ Error: Same number produced different codenames (not deterministic)"
143+
echo " First run: ${{ steps.deterministic1.outputs.codename }}"
144+
echo " Second run: ${{ steps.deterministic2.outputs.codename }}"
145+
exit 1
146+
fi
147+
echo "✅ Deterministic behavior test passed:"
148+
echo " Number: 999 consistently produces: ${{ steps.deterministic1.outputs.codename }}"
149+
150+
- name: Test edge case - zero
151+
id: edge_zero
152+
uses: ./
153+
with:
154+
number: 0
155+
env:
156+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
157+
158+
- name: Validate edge case - zero
159+
run: |
160+
if [ "${{ steps.edge_zero.outputs.number }}" != "0" ]; then
161+
echo "❌ Error: Expected number 0, got ${{ steps.edge_zero.outputs.number }}"
162+
exit 1
163+
fi
164+
if [ -z "${{ steps.edge_zero.outputs.codename }}" ]; then
165+
echo "❌ Error: No codename output for edge case zero"
166+
exit 1
167+
fi
168+
echo "✅ Edge case (zero) test passed:"
169+
echo " Number: ${{ steps.edge_zero.outputs.number }}"
170+
echo " Codename: ${{ steps.edge_zero.outputs.codename }}"

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Built files (excluded during development, included in releases)
2+
dist/
3+
4+
# Dependencies
5+
node_modules/
6+
7+
# Logs
8+
*.log
9+
npm-debug.log*
10+
11+
# Local markdown files
12+
*.local.md
13+
14+
# OS files
15+
.DS_Store
16+
Thumbs.db
17+
18+
# TypeScript
19+
*.tsbuildinfo

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"editor.defaultFormatter": "esbenp.prettier-vscode",
3+
"editor.formatOnSave": true,
4+
"editor.tabSize": 2,
5+
"prettier.singleQuote": false,
6+
"cSpell.words": ["codename", "codenames", "kriasoft", "konstantin", "tarkus"]
7+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025-present Kriasoft
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)