Skip to content

Commit 954debe

Browse files
committed
Add initial structure
0 parents  commit 954debe

12 files changed

+4767
-0
lines changed

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/
2+
lib/
3+
node_modules/

.eslintrc.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"plugins": ["jest", "@typescript-eslint"],
3+
"extends": ["plugin:github/es6"],
4+
"parser": "@typescript-eslint/parser",
5+
"parserOptions": {
6+
"ecmaVersion": 9,
7+
"sourceType": "module",
8+
"project": "./tsconfig.json"
9+
},
10+
"env": {
11+
"node": true,
12+
"es6": true,
13+
"jest/globals": true
14+
}
15+
}

.github/workflows/test.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: "test"
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- master
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v1
14+
- run: |
15+
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
16+
- uses: ./
17+
with:
18+
github_token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Dependency directory
2+
node_modules
3+
4+
# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
5+
# Logs
6+
logs
7+
*.log
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
lerna-debug.log*
12+
13+
# Diagnostic reports (https://nodejs.org/api/report.html)
14+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
15+
16+
# Runtime data
17+
pids
18+
*.pid
19+
*.seed
20+
*.pid.lock
21+
22+
# Directory for instrumented libs generated by jscoverage/JSCover
23+
lib-cov
24+
25+
# Coverage directory used by tools like istanbul
26+
coverage
27+
*.lcov
28+
29+
# nyc test coverage
30+
.nyc_output
31+
32+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
33+
.grunt
34+
35+
# Bower dependency directory (https://bower.io/)
36+
bower_components
37+
38+
# node-waf configuration
39+
.lock-wscript
40+
41+
# Compiled binary addons (https://nodejs.org/api/addons.html)
42+
build/Release
43+
44+
# Dependency directories
45+
jspm_packages/
46+
47+
# TypeScript v1 declaration files
48+
typings/
49+
50+
# TypeScript cache
51+
*.tsbuildinfo
52+
53+
# Optional npm cache directory
54+
.npm
55+
56+
# Optional eslint cache
57+
.eslintcache
58+
59+
# Optional REPL history
60+
.node_repl_history
61+
62+
# Output of 'npm pack'
63+
*.tgz
64+
65+
# Yarn Integrity file
66+
.yarn-integrity
67+
68+
# dotenv environment variables file
69+
.env
70+
.env.test
71+
72+
# parcel-bundler cache (https://parceljs.org/)
73+
.cache
74+
75+
# next.js build output
76+
.next
77+
78+
# nuxt.js build output
79+
.nuxt
80+
81+
# vuepress build output
82+
.vuepress/dist
83+
84+
# Serverless directories
85+
.serverless/
86+
87+
# FuseBox cache
88+
.fusebox/
89+
90+
# DynamoDB Local files
91+
.dynamodb/
92+
93+
# OS metadata
94+
.DS_Store
95+
Thumbs.db
96+
97+
# Ignore built ts files
98+
__tests__/runner/*
99+
lib/**/*

LICENSE

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ISC License
2+
3+
Copyright (c) 2020, Matan Kushner <[email protected]>
4+
5+
Permission to use, copy, modify, and/or distribute this software for any
6+
purpose with or without fee is hereby granted, provided that the above
7+
copyright notice and this permission notice appear in all copies.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# size-limit-action

action.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: 'size-limit-action'
2+
description: 'size-limit action'
3+
author: 'Andres Alvarez <[email protected]>'
4+
branding:
5+
icon: 'activity'
6+
color: 'green'
7+
inputs:
8+
access_token:
9+
required: true
10+
description: 'a github access token'
11+
runs:
12+
using: 'node12'
13+
main: 'dist/index.js'

jest.config.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
clearMocks: true,
3+
moduleFileExtensions: ['js', 'ts'],
4+
testEnvironment: 'node',
5+
testMatch: ['**/*.test.ts'],
6+
testRunner: 'jest-circus/runner',
7+
transform: {
8+
'^.+\\.ts$': 'ts-jest'
9+
},
10+
verbose: true
11+
}

package.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "size-limit-action",
3+
"version": "0.1.0",
4+
"private": true,
5+
"description": "size-limit action",
6+
"main": "lib/main.js",
7+
"license": "ISC",
8+
"scripts": {
9+
"build": "tsc",
10+
"format": "prettier --write **/*.ts",
11+
"lint": "eslint src/**/*.ts",
12+
"pack": "ncc build",
13+
"test": "jest"
14+
},
15+
"dependencies": {
16+
"@actions/core": "^1.2.3",
17+
"@actions/github": "^2.1.1"
18+
},
19+
"devDependencies": {
20+
"@types/jest": "^24.0.23",
21+
"@types/node": "^12.7.12",
22+
"@typescript-eslint/parser": "^2.8.0",
23+
"@zeit/ncc": "^0.20.5",
24+
"eslint": "^5.16.0",
25+
"eslint-plugin-github": "^2.0.0",
26+
"eslint-plugin-jest": "^22.21.0",
27+
"jest": "^24.9.0",
28+
"jest-circus": "^24.9.0",
29+
"js-yaml": "^3.13.1",
30+
"prettier": "^1.19.1",
31+
"ts-jest": "^24.2.0",
32+
"typescript": "^3.6.4"
33+
}
34+
}

src/main.ts

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { getInput, setFailed } from "@actions/core";
2+
import { context, GitHub } from "@actions/github";
3+
4+
async function run() {
5+
try {
6+
const message = "message";
7+
const token = getInput("github_token");
8+
9+
if (context.payload.pull_request == null) {
10+
setFailed("No pull request found.");
11+
return;
12+
}
13+
14+
const number = context.payload.pull_request.number;
15+
const octokit = new GitHub(token);
16+
17+
octokit.issues.createComment({
18+
...context.repo,
19+
// eslint-disable-next-line camelcase
20+
issue_number: number,
21+
body: message
22+
});
23+
} catch (error) {
24+
setFailed(error.message);
25+
}
26+
}
27+
28+
run();

tsconfig.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
4+
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
5+
"outDir": "./lib", /* Redirect output structure to the directory. */
6+
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
7+
"strict": true, /* Enable all strict type-checking options. */
8+
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
9+
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
10+
},
11+
"exclude": ["node_modules", "**/*.test.ts"]
12+
}

0 commit comments

Comments
 (0)