├── .gitignore ├── bun.lockb ├── README.md ├── tsconfig.json ├── .editorconfig ├── action.yml ├── .github ├── dependabot.yml └── workflows │ ├── release.yaml │ └── ci.yaml ├── biome.json ├── index.ts ├── package.json └── LICENCE.md /.gitignore: -------------------------------------------------------------------------------- 1 | /dist/ 2 | /node_modules/ 3 | -------------------------------------------------------------------------------- /bun.lockb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yumemi-inc/typescript-action-template/HEAD/bun.lockb -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TypeScript Action Template 2 | 3 | > **Warning** 4 | > This is not an official product of YUMEMI Inc. 5 | 6 | Simple and robust template for GitHub Action in TypeScript. 7 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "CommonJS", 4 | "target": "ES2022", 5 | "strict": true 6 | }, 7 | "exclude": [ 8 | "node_modules" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 2 7 | indent_style = space 8 | insert_final_newline = true 9 | max_line_length = 120 10 | trim_trailing_whitespace = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 2 | description: 3 | author: 4 | branding: 5 | icon: check 6 | color: green 7 | runs: 8 | using: node20 9 | main: 'index.js' 10 | inputs: 11 | token: 12 | required: true 13 | description: Authenticated GitHub token. 14 | default: '${{ github.token }}' 15 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: npm 4 | directory: / 5 | schedule: 6 | interval: weekly 7 | ignore: 8 | - dependency-name: '@types/node' 9 | update-types: 10 | - version-update:semver-major 11 | - version-update:semver-minor 12 | 13 | - package-ecosystem: github-actions 14 | directory: / 15 | schedule: 16 | interval: weekly 17 | -------------------------------------------------------------------------------- /biome.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@biomejs/biome/configuration_schema.json", 3 | "organizeImports": { 4 | "enabled": true 5 | }, 6 | "formatter": { 7 | "enabled": true, 8 | "indentStyle": "space" 9 | }, 10 | "linter": { 11 | "enabled": true, 12 | "rules": { 13 | "recommended": true 14 | } 15 | }, 16 | "javascript": { 17 | "formatter": { 18 | "quoteStyle": "single", 19 | "semicolons": "always", 20 | "trailingComma": "all" 21 | } 22 | }, 23 | "files": { 24 | "ignore": ["index.js"] 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /index.ts: -------------------------------------------------------------------------------- 1 | import { exit } from 'node:process'; 2 | 3 | import { error, getInput } from '@actions/core'; 4 | import { context } from '@actions/github'; 5 | import { Octokit } from '@octokit/rest'; 6 | import fetch from 'node-fetch'; 7 | 8 | const getInputRequired = (name: string) => 9 | getInput(name, { 10 | required: true, 11 | }); 12 | 13 | (async () => { 14 | const octokit = new Octokit({ 15 | baseUrl: context.apiUrl, 16 | auth: getInputRequired('token'), 17 | request: { 18 | fetch, 19 | }, 20 | }); 21 | 22 | // Do something... 23 | })() 24 | .then() 25 | .catch((e) => { 26 | error(e); 27 | exit(1); 28 | }); 29 | -------------------------------------------------------------------------------- /.github/workflows/release.yaml: -------------------------------------------------------------------------------- 1 | name: Release 2 | run-name: Release ${{ inputs.version }} 3 | 4 | on: 5 | workflow_dispatch: 6 | inputs: 7 | version: 8 | type: string 9 | description: 'Version name of the new release.' 10 | required: true 11 | 12 | jobs: 13 | new: 14 | name: New Release 15 | runs-on: ubuntu-22.04 16 | permissions: 17 | contents: write 18 | steps: 19 | - uses: actions/checkout@v4 20 | 21 | - uses: oven-sh/setup-bun@v1 22 | with: 23 | bun-version: '1.0.0' 24 | 25 | - uses: yumemi-inc/action-release-action@v2 26 | with: 27 | version: '${{ inputs.version }}' 28 | build-command: 'bun install --frozen-lockfile && bun run build' 29 | -------------------------------------------------------------------------------- /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | branches: 9 | - main 10 | workflow_dispatch: ~ 11 | 12 | jobs: 13 | test: 14 | name: Test 15 | runs-on: ubuntu-22.04 16 | permissions: 17 | contents: read 18 | steps: 19 | - uses: actions/checkout@v4 20 | 21 | - uses: oven-sh/setup-bun@v1 22 | with: 23 | bun-version: '1.0.0' 24 | 25 | - uses: actions/cache@v3 26 | with: 27 | path: ~/.bun/install/cache 28 | key: ${{ runner.os }}-bun-${{ hashFiles('bun.lockb') }} 29 | restore-keys: ${{ runner.os }}-bun- 30 | 31 | - run: bun install --frozen-lockfile 32 | - run: bun run check 33 | - run: bun run build 34 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@your-name/your-package-name", 3 | "description": "Description of your action...", 4 | "author": "Your Name ", 5 | "license": "MIT", 6 | "readme": "README.md", 7 | "main": "index.js", 8 | "scripts": { 9 | "build": "bun build index.ts --target=node --outfile=dist/index.js", 10 | "check": "biome format . && biome check .", 11 | "fix": "biome format --write . && biome check --apply-unsafe ." 12 | }, 13 | "dependencies": { 14 | "@actions/core": "^1.10.0", 15 | "@actions/exec": "^1.1.1", 16 | "@actions/github": "^5.1.1", 17 | "@octokit/rest": "^20.0.1", 18 | "node-fetch": "^3.3.2" 19 | }, 20 | "devDependencies": { 21 | "@biomejs/biome": "^1.1.1", 22 | "@types/node": "^20.5.9", 23 | "typescript": "^5.2.2" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /LICENCE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 YUMEMI Inc. 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. 22 | --------------------------------------------------------------------------------