Skip to content

Commit 2e96f56

Browse files
authored
feat: javascript action no post (#5)
* feat: use javascript for the action * fix: add build and test github action * fix: update latest changes * fix: use the action on PR! :D * fix: updated readme and test with error step * fix: test on failure and cancelled * fix: fix action yaml * fix: check the ispost value when multiple actions run * fix: more tests when action fails and update documentation * fix: set the comment based in selected commit status check instead of start/end * fix: trigger action again * fix: action inputs * fix: set status to pending * fix: fixed error * feature: test without post * fix: trigger error * fix: updated documentation * fix: fixed workflow
1 parent f5f59e0 commit 2e96f56

27 files changed

+20840
-85
lines changed

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/
2+
lib/
3+
node_modules/

.eslintrc.json

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{
2+
"plugins": [
3+
"jest",
4+
"@typescript-eslint"
5+
],
6+
"extends": [
7+
"plugin:github/es6"
8+
],
9+
"parser": "@typescript-eslint/parser",
10+
"parserOptions": {
11+
"ecmaVersion": 9,
12+
"sourceType": "module",
13+
"project": "./tsconfig.json"
14+
},
15+
"rules": {
16+
"object-shorthand": [
17+
2,
18+
"consistent"
19+
],
20+
"eslint-comments/no-use": "off",
21+
"import/no-namespace": "off",
22+
"no-unused-vars": "off",
23+
"@typescript-eslint/no-unused-vars": "error",
24+
"@typescript-eslint/explicit-member-accessibility": [
25+
"error",
26+
{
27+
"accessibility": "no-public"
28+
}
29+
],
30+
"@typescript-eslint/no-require-imports": "error",
31+
"@typescript-eslint/array-type": "error",
32+
"@typescript-eslint/await-thenable": "error",
33+
"@typescript-eslint/ban-ts-ignore": "error",
34+
"camelcase": "off",
35+
"@typescript-eslint/camelcase": [
36+
"error",
37+
{
38+
"properties": "never"
39+
}
40+
],
41+
"@typescript-eslint/class-name-casing": "error",
42+
"@typescript-eslint/explicit-function-return-type": [
43+
"error",
44+
{
45+
"allowExpressions": true
46+
}
47+
],
48+
"@typescript-eslint/func-call-spacing": [
49+
"error",
50+
"never"
51+
],
52+
"@typescript-eslint/generic-type-naming": [
53+
"error",
54+
"^[A-Z][A-Za-z]*$"
55+
],
56+
"@typescript-eslint/no-array-constructor": "error",
57+
"@typescript-eslint/no-empty-interface": "error",
58+
"@typescript-eslint/no-explicit-any": "error",
59+
"@typescript-eslint/no-extraneous-class": "error",
60+
"@typescript-eslint/no-for-in-array": "error",
61+
"@typescript-eslint/no-inferrable-types": "error",
62+
"@typescript-eslint/no-misused-new": "error",
63+
"@typescript-eslint/no-namespace": "error",
64+
"@typescript-eslint/no-non-null-assertion": "warn",
65+
"@typescript-eslint/no-object-literal-type-assertion": "error",
66+
"@typescript-eslint/no-unnecessary-qualifier": "error",
67+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
68+
"@typescript-eslint/no-useless-constructor": "error",
69+
"@typescript-eslint/no-var-requires": "error",
70+
"@typescript-eslint/prefer-for-of": "warn",
71+
"@typescript-eslint/prefer-function-type": "warn",
72+
"@typescript-eslint/prefer-includes": "error",
73+
"@typescript-eslint/prefer-interface": "error",
74+
"@typescript-eslint/prefer-string-starts-ends-with": "error",
75+
"@typescript-eslint/promise-function-async": "error",
76+
"@typescript-eslint/require-array-sort-compare": "error",
77+
"@typescript-eslint/restrict-plus-operands": "error",
78+
"semi": "off",
79+
"@typescript-eslint/semi": [
80+
"error",
81+
"never"
82+
],
83+
"@typescript-eslint/type-annotation-spacing": "error",
84+
"@typescript-eslint/unbound-method": "error"
85+
},
86+
"env": {
87+
"node": true,
88+
"es6": true,
89+
"jest/globals": true
90+
}
91+
}

.github/workflows/pull_request.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: PR Build and test
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- uses: ./
11+
with:
12+
addHoldComment: "true"
13+
status: "pending"
14+
- run: npm ci
15+
- run: npm run build
16+
- run: npm run format-check
17+
- run: npm run lint
18+
- run: npm run pack
19+
- run: npm test
20+
# If something fails I want to set the status commit to "error" without adding anymore comments
21+
# I'm happy to leave the PR with `/hold` if there is an error
22+
- if: always()
23+
uses: ./
24+
with:
25+
addHoldComment: "true"

.github/workflows/push.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Build and test
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- run: npm ci
14+
- run: npm run build
15+
- run: npm run format-check
16+
- run: npm run lint
17+
- run: npm run pack
18+
- run: npm test

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
lib/
2+
node_modules/
3+
coverage

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/
2+
lib/
3+
node_modules/

.prettierrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"printWidth": 80,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": false,
6+
"singleQuote": true,
7+
"trailingComma": "none",
8+
"bracketSpacing": false,
9+
"arrowParens": "avoid",
10+
"parser": "typescript"
11+
}

.vscode/launch.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node",
9+
"request": "launch",
10+
"name": "Debug Jest Tests",
11+
"cwd": "${workspaceFolder}",
12+
"args": [
13+
"--inspect-brk",
14+
"${workspaceRoot}/node_modules/.bin/jest",
15+
"--runInBand",
16+
"--config",
17+
"${workspaceRoot}/jest.config.js"
18+
],
19+
"windows": {
20+
"args": [
21+
"--inspect-brk",
22+
"${workspaceRoot}/node_modules/jest/bin/jest.js",
23+
"--runInBand",
24+
"--config",
25+
"${workspaceRoot}/jest.config.js"
26+
],
27+
},
28+
"console": "integratedTerminal",
29+
"internalConsoleOptions": "neverOpen"
30+
}
31+
]
32+
}

Dockerfile

Lines changed: 0 additions & 7 deletions
This file was deleted.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2019 The Ouzi Authors
189+
Copyright 2020 The Ouzi Authors
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

Makefile

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,28 @@
1+
2+
.PHONY: clean
3+
clean:
4+
npm run clean
5+
6+
.PHONY: install
7+
install:
8+
npm install
9+
110
.PHONY: build
2-
build:
3-
chmod +x update-status.sh
4-
docker build -t commit-status-updater .
11+
build:
12+
npm run build
13+
14+
.PHONY: test
15+
test: build
16+
npm test
17+
18+
.PHONY: coverage
19+
coverage: build
20+
npm run coverage
21+
22+
.PHONY: all
23+
all:
24+
npm run all
525

6-
.PHONY: shellcheck
7-
shellcheck:
8-
docker run --rm -v "$(CURDIR):/mnt" koalaman/shellcheck:stable update-status.sh
26+
.PHONY: release
27+
release: all
28+
npm prune --production

0 commit comments

Comments
 (0)