Skip to content

Commit dc7dfac

Browse files
Merge pull request #35 from technote-space/release/v1.1.0
Release/v1.1.0
2 parents 2cef19b + f572c9a commit dc7dfac

18 files changed

+1159
-420
lines changed

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
indent_style = tab
9+
indent_size = 4
10+
11+
[{*.json,*.yml}]
12+
indent_style = space
13+
indent_size = 2

.eslintrc

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
{
2+
"extends": [
3+
"eslint:recommended",
4+
"plugin:@typescript-eslint/recommended",
5+
"plugin:@typescript-eslint/eslint-recommended"
6+
],
7+
"plugins": [
8+
"@typescript-eslint"
9+
],
10+
"parser": "@typescript-eslint/parser",
11+
"parserOptions": {
12+
"sourceType": "module",
13+
"ecmaVersion": 2018
14+
},
15+
"env": {
16+
"node": true,
17+
"jest": true,
18+
"es6": true,
19+
"browser": true
20+
},
21+
"settings": {
22+
"react": {
23+
"version": "latest"
24+
}
25+
},
26+
"rules": {
27+
"camelcase": [
28+
"error",
29+
{
30+
"properties": "always"
31+
}
32+
],
33+
"require-jsdoc": [
34+
"error",
35+
{
36+
"require": {
37+
"FunctionDeclaration": true,
38+
"MethodDefinition": true,
39+
"ClassDeclaration": true
40+
}
41+
}
42+
],
43+
"valid-jsdoc": [
44+
"error",
45+
{
46+
"requireReturn": false,
47+
"preferType": {
48+
"String": "string",
49+
"Object": "object",
50+
"Number": "number",
51+
"Function": "function",
52+
"Void": "void"
53+
}
54+
}
55+
],
56+
"quotes": [
57+
"error",
58+
"single",
59+
"avoid-escape"
60+
],
61+
"key-spacing": [
62+
"error",
63+
{
64+
"singleLine": {
65+
"beforeColon": false,
66+
"afterColon": true
67+
},
68+
"multiLine": {
69+
"beforeColon": false,
70+
"afterColon": true
71+
}
72+
}
73+
],
74+
"no-magic-numbers": [
75+
"error",
76+
{
77+
"ignoreArrayIndexes": true
78+
}
79+
],
80+
"eqeqeq": "error",
81+
"block-scoped-var": "error",
82+
"complexity": [
83+
"error",
84+
{
85+
"maximum": 20
86+
}
87+
],
88+
"curly": "error",
89+
"default-case": "error",
90+
"dot-location": [
91+
"error",
92+
"property"
93+
],
94+
"guard-for-in": "error",
95+
"no-eval": "error",
96+
"block-spacing": "error",
97+
"brace-style": "error",
98+
"comma-spacing": [
99+
"error",
100+
{
101+
"before": false,
102+
"after": true
103+
}
104+
],
105+
"id-length": [
106+
"error",
107+
{
108+
"min": 2,
109+
"properties": "never",
110+
"exceptions": [
111+
"$"
112+
]
113+
}
114+
],
115+
"indent": [
116+
"error",
117+
"tab",
118+
{
119+
"MemberExpression": "off"
120+
}
121+
],
122+
"space-before-function-paren": [
123+
"error",
124+
"never"
125+
],
126+
"space-before-blocks": "error",
127+
"prefer-const": "error",
128+
"no-var": "error",
129+
"arrow-body-style": "off",
130+
"arrow-spacing": "error",
131+
"strict": [
132+
"error"
133+
],
134+
"no-warning-comments": [
135+
"warn",
136+
{
137+
"terms": [
138+
"todo",
139+
"fixme",
140+
"hack"
141+
],
142+
"location": "anywhere"
143+
}
144+
],
145+
"semi": [
146+
"error"
147+
]
148+
}
149+
}

.github/CONTRIBUTING.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
[issues]: https://github.com/technote-space/assign-author/issues
33
[fork]: https://github.com/technote-space/assign-author/fork
44
[pr]: https://github.com/technote-space/assign-author/compare
5+
[eslint]: https://eslint.org/
56
[jest]: https://jestjs.io/
67
[code-of-conduct]: CODE_OF_CONDUCT.md
78

@@ -12,7 +13,8 @@ Please note we have a [Contributor Code of Conduct][code-of-conduct], please fol
1213
## Submitting a pull request
1314

1415
1. [Fork][fork] and clone the repository
15-
1. Make sure the tests pass on your machine: `composer test`, which contains
16+
1. Make sure the tests pass on your machine: `yarn test`, which contains
17+
- [`ESLint`][eslint]
1618
- [`Jest`][jest]
1719
1. Create a new branch: `git checkout -b my-branch-name`
1820
1. Make your change, add tests, and make sure the tests still pass.

.github/workflows/ci.yml

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,75 @@ on:
99
name: Build
1010

1111
jobs:
12+
eslint:
13+
name: ESLint
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v1
17+
with:
18+
fetch-depth: 3
19+
- name: Install Package dependencies
20+
run: yarn install
21+
- name: Check code style
22+
run: yarn lint
23+
- uses: 8398a7/action-slack@v1
24+
with:
25+
type: failure
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
29+
if: failure()
30+
1231
jest:
1332
name: Jest
1433
runs-on: ubuntu-latest
34+
strategy:
35+
matrix:
36+
node: ['8', '10', '11', '12']
1537
steps:
1638
- uses: actions/checkout@v1
1739
with:
18-
fetch-depth: 1
40+
fetch-depth: 3
41+
- name: Setup node
42+
uses: actions/setup-node@v1
43+
with:
44+
node-version: ${{ matrix.node }}
1945
- name: Install Package dependencies
2046
run: yarn install
2147
- name: Run tests
2248
run: yarn cover
23-
- name: Send covarage
24-
run: yarn add coveralls && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
25-
env:
26-
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
27-
COVERALLS_SERVICE_NAME: "GitHub Action"
28-
COVERALLS_SERVICE_JOB_ID: ${{ github.sha }}
29-
COVERALLS_GIT_COMMIT: ${{ github.sha }}
30-
COVERALLS_GIT_BRANCH: ${{ github.ref }}
49+
- name: Coveralls
50+
uses: coverallsapp/github-action@master
51+
with:
52+
github-token: ${{ secrets.github_token }}
53+
parallel: true
3154
- uses: 8398a7/action-slack@v1
3255
with:
3356
type: failure
3457
env:
3558
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3659
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
3760
if: failure()
61+
62+
coverallsFinished:
63+
name: Coveralls Finished
64+
needs: jest
65+
runs-on: ubuntu-latest
66+
steps:
67+
- name: Coveralls Finished
68+
uses: coverallsapp/github-action@master
69+
with:
70+
github-token: ${{ secrets.github_token }}
71+
parallel-finished: true
72+
73+
slack:
74+
name: Slack
75+
needs: coverallsFinished
76+
runs-on: ubuntu-latest
77+
steps:
3878
- uses: 8398a7/action-slack@v1
3979
with:
4080
type: success
4181
env:
4282
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4383
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
44-
if: success()
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"message": "Resource not accessible by integration",
3+
"documentation_url": "https://developer.github.com/v3"
4+
}

__tests__/util.ts

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,37 @@
1-
const fs = require('fs');
2-
const path = require('path');
3-
4-
export const getContext = (override: object) => Object.assign({
5-
payload: {
6-
action: '',
7-
},
8-
eventName: '',
9-
sha: '',
10-
ref: '',
11-
workflow: '',
12-
action: '',
13-
actor: '',
14-
issue: {
15-
owner: '',
16-
repo: '',
17-
number: 1,
18-
},
19-
repo: {
20-
owner: '',
21-
repo: '',
22-
},
23-
}, override);
24-
25-
export const getApiFixture = (name: string) => JSON.parse(fs.readFileSync(path.resolve(__dirname, `./fixtures/${name}.json`)));
26-
27-
export const disableNetConnect = nock => {
28-
beforeEach(() => {
29-
nock.disableNetConnect();
30-
});
31-
32-
afterEach(() => {
33-
nock.cleanAll();
34-
nock.enableNetConnect();
35-
});
36-
};
1+
import { Context } from '@actions/github/lib/context';
2+
import * as fs from 'fs';
3+
import * as path from 'path';
4+
5+
export const getContext = (override: object): Context => Object.assign({
6+
payload: {
7+
action: '',
8+
},
9+
eventName: '',
10+
sha: '',
11+
ref: '',
12+
workflow: '',
13+
action: '',
14+
actor: '',
15+
issue: {
16+
owner: '',
17+
repo: '',
18+
number: 1,
19+
},
20+
repo: {
21+
owner: '',
22+
repo: '',
23+
},
24+
}, override);
25+
26+
export const getApiFixture = (name: string): object => JSON.parse(fs.readFileSync(path.resolve(__dirname, `./fixtures/${name}.json`)).toString());
27+
28+
export const disableNetConnect = (nock): void => {
29+
beforeEach(() => {
30+
nock.disableNetConnect();
31+
});
32+
33+
afterEach(() => {
34+
nock.cleanAll();
35+
nock.enableNetConnect();
36+
});
37+
};

0 commit comments

Comments
 (0)