Skip to content

Commit e8d1b9d

Browse files
committed
Initial commit: GitHub TypeScript composite action
- Complete action.yml with all github-script passthrough inputs - Biome configuration for linting and formatting - Comprehensive README with usage examples - CI workflow with self-testing - Example scripts for basic usage and utils integration
0 parents  commit e8d1b9d

File tree

11 files changed

+823
-0
lines changed

11 files changed

+823
-0
lines changed

.github/workflows/ci.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint:
11+
name: Lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Setup pnpm
18+
uses: pnpm/action-setup@v4
19+
with:
20+
version: 10
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: 22
26+
cache: pnpm
27+
28+
- name: Install dependencies
29+
run: pnpm install
30+
31+
- name: Run Biome
32+
run: pnpm run check
33+
34+
test-action:
35+
name: Test Action
36+
runs-on: ubuntu-latest
37+
needs: lint
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v4
41+
42+
- name: Create test script
43+
run: |
44+
mkdir -p .github/scripts
45+
cat > .github/scripts/test.ts << 'EOF'
46+
export default async function run({ core, context, args }) {
47+
core.info('Test script running!');
48+
core.info(`Context: ${context.eventName}`);
49+
core.info(`Args: ${JSON.stringify(args)}`);
50+
return {
51+
success: true,
52+
eventName: context.eventName,
53+
args
54+
};
55+
}
56+
EOF
57+
58+
- name: Test the action
59+
id: test
60+
uses: ./
61+
with:
62+
ts-file: .github/scripts/test.ts
63+
args: '{"message":"Hello from test!","timestamp":"${{ github.event.head_commit.timestamp || github.run_id }}"}'
64+
65+
- name: Verify result
66+
run: |
67+
echo "Action result: ${{ steps.test.outputs.result }}"
68+
# Parse and verify the JSON result contains expected fields
69+
echo '${{ steps.test.outputs.result }}' | jq -e '.success == true'
70+
echo '${{ steps.test.outputs.result }}' | jq -e '.eventName'
71+
echo '${{ steps.test.outputs.result }}' | jq -e '.args.message == "Hello from test!"'

.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Dependencies
2+
node_modules/
3+
pnpm-lock.yaml
4+
5+
# Build outputs
6+
dist/
7+
.github-script-build/
8+
9+
# Runtime/cache
10+
.cache/
11+
tmp/
12+
temp/
13+
14+
# IDE
15+
.cursor/
16+
.vscode/
17+
.idea/
18+
*.swp
19+
*.swo
20+
*~
21+
22+
# OS
23+
.DS_Store
24+
Thumbs.db
25+
26+
# Logs
27+
*.log
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
lerna-debug.log*
32+
33+
# Coverage reports
34+
coverage/
35+
*.lcov
36+
37+
# Environment variables
38+
.env
39+
.env.local
40+
.env.development.local
41+
.env.test.local
42+
.env.production.local

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22

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 tkstang
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)