Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
siketyan authored Aug 24, 2023
0 parents commit a2b5e20
Show file tree
Hide file tree
Showing 13 changed files with 896 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 120
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2
updates:
- package-ecosystem: npm
directory: /
schedule:
interval: weekly
ignore:
- dependency-name: '@types/node'
update-types:
- version-update:semver-major
- version-update:semver-minor

- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
39 changes: 39 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch: ~

jobs:
test:
name: Test
runs-on: ubuntu-22.04
permissions:
contents: read
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: '18'

- run: corepack enable pnpm

- id: pnpm-cache
shell: bash
run: echo "path=$(pnpm store path)" >> "${GITHUB_OUTPUT}"

- uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.path }}
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-pnpm-

- run: pnpm install --frozen-lockfile
- run: pnpm run check
- run: pnpm run build
28 changes: 28 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
type: string
description: 'Version name of the new release.'
required: true

jobs:
new:
name: New Release
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: '18'

- run: corepack enable pnpm

- uses: yumemi-inc/action-release-action@v2
with:
version: '${{ inputs.version }}'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/dist/
/node_modules/
21 changes: 21 additions & 0 deletions LICENCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 YUMEMI Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# TypeScript Action Template

> **Warning**
> This is not an official product of YUMEMI Inc.
Simple and robust template for GitHub Action in TypeScript.
14 changes: 14 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: <Your Action>
description: <Description of your action...>
author: <Your name>
branding:
icon: check
color: green
runs:
using: node16
main: 'index.js'
inputs:
token:
required: true
description: Authenticated GitHub token.
default: '${{ github.token }}'
28 changes: 28 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { exit } from 'node:process';

import { error, getInput } from '@actions/core';
import { context } from '@actions/github';
import { Octokit } from '@octokit/rest';
import fetch from 'node-fetch';

const getInputRequired = (name: string) =>
getInput(name, {
required: true,
});

(async () => {
const octokit = new Octokit({
baseUrl: context.apiUrl,
auth: getInputRequired('token'),
request: {
fetch,
},
});

// Do something...
})()
.then()
.catch((e) => {
error(e);
exit(1);
});
26 changes: 26 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "@your-name/your-package-name",
"description": "Description of your action...",
"author": "Your Name <your@email.example.com>",
"license": "MIT",
"readme": "README.md",
"main": "index.js",
"scripts": {
"build": "esbuild index.ts --bundle --platform=node --outfile=dist/index.js",
"check": "rome format . && rome check .",
"fix": "rome format --write . && rome check --apply-unsafe ."
},
"dependencies": {
"@actions/core": "^1.10.0",
"@actions/exec": "^1.1.1",
"@actions/github": "^5.1.1",
"@octokit/rest": "^20.0.1",
"node-fetch": "^3.3.2"
},
"devDependencies": {
"@types/node": "^16.18.41",
"esbuild": "^0.19.2",
"rome": "^12.1.3",
"typescript": "^5.1.6"
}
}
Loading

0 comments on commit a2b5e20

Please sign in to comment.