Skip to content

Commit 9cec7d5

Browse files
committed
Merge branch 'master' into releases/v1
2 parents 0f5a803 + bea2b67 commit 9cec7d5

15 files changed

Lines changed: 12998 additions & 3224 deletions

.github/FUNDING.yml

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

.github/workflows/ci.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
on: push
1+
on:
2+
pull_request:
3+
push:
4+
branches:
5+
- master
26

37
name: CI
48

@@ -8,31 +12,27 @@ jobs:
812

913
runs-on: ubuntu-latest
1014

15+
strategy:
16+
matrix:
17+
node: [12, 13]
18+
1119
steps:
1220
- name: Checkout Repo
13-
uses: actions/checkout@master
21+
uses: actions/checkout@v2.0.0
1422

1523
- name: Install Node
16-
uses: actions/setup-node@v1
24+
uses: actions/setup-node@v1.3.0
1725
with:
18-
node-version: "12.x"
19-
20-
- name: Version Info
21-
run: |
22-
node --version
23-
npm --version
26+
node-version: ${{ matrix.node }}
2427

25-
- name: Install Dependencies
26-
run: npm ci
28+
- run: npm ci
2729

28-
- name: Build
29-
run: npm run build
30+
- run: npm test
3031

31-
- name: Test
32-
run: npm test
32+
- run: npm run build
3333

3434
- name: Upload Test Coverage
35-
uses: codecov/codecov-action@v1.0.2
35+
uses: codecov/codecov-action@v1.0.5
3636
with:
3737
token: ${{ secrets.CODECOV_TOKEN }}
3838
file: ./coverage/clover.xml

.github/workflows/pull_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ jobs:
1010

1111
steps:
1212
- name: Block Autosquash Commits
13-
uses: xt0rted/block-autosquash-commits-action@master
13+
uses: xt0rted/block-autosquash-commits-action@v2.0.0
1414
with:
1515
repo-token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

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

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
"Octokit",
66
"gravatar",
77
"repos"
8-
]
8+
],
9+
"typescript.tsdk": "node_modules\\typescript\\lib"
910
}

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Slash Commands Action
22

3-
![GitHub Actions Status](https://github.com/xt0rted/slash-command-action/workflows/CI/badge.svg) [![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=xt0rted/slash-command-action)](https://dependabot.com) [![codecov](https://codecov.io/gh/xt0rted/slash-command-action/branch/master/graph/badge.svg)](https://codecov.io/gh/xt0rted/slash-command-action)
3+
[![CI](https://github.com/xt0rted/slash-command-action/workflows/CI/badge.svg)](https://github.com/xt0rted/slash-command-action/actions?query=workflow%3ACI)
4+
[![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=xt0rted/slash-command-action)](https://dependabot.com)
5+
[![codecov](https://codecov.io/gh/xt0rted/slash-command-action/branch/master/graph/badge.svg)](https://codecov.io/gh/xt0rted/slash-command-action)
46

57
Check issue or pull request comments for `/commands` and trigger or block workflows based on them.
68

@@ -18,13 +20,14 @@ jobs:
1820
steps:
1921
- name: Check for Command
2022
id: command
21-
uses: xt0rted/slash-command-action
23+
uses: xt0rted/slash-command-action@v1
2224
with:
2325
repo-token: ${{ secrets.GITHUB_TOKEN }}
2426
command: test
27+
reaction: "true"
2528
reaction-type: "eyes"
26-
run-on-edit: "false"
27-
user-level: admin
29+
allow-edits: "false"
30+
permission-level: admin
2831
- name: Act on the command
2932
run: echo "The command was '${{ steps.command.outputs.command-name }}' with arguments '${{ steps.command.outputs.command-arguments }}'"
3033
```

__tests__/commandHandler.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe("commandHandler", () => {
3030
context.payload = require(join(__dirname, "payloads", "edited.json"));
3131

3232
const commandHandler = new CommandHandler(
33-
/* repoToken */ "",
33+
/* repoToken */ "-token-",
3434
/* commandName */ "format",
3535
/* addReaction */ false,
3636
/* reactionType */ "+1",
@@ -45,7 +45,7 @@ describe("commandHandler", () => {
4545
context.payload = require(join(__dirname, "payloads", "created-no-command.json"));
4646

4747
const commandHandler = new CommandHandler(
48-
/* repoToken */ "",
48+
/* repoToken */ "-token-",
4949
/* commandName */ "format",
5050
/* addReaction */ false,
5151
/* reactionType */ "+1",
@@ -60,7 +60,7 @@ describe("commandHandler", () => {
6060
context.payload = require(join(__dirname, "payloads", "created.json"));
6161

6262
const commandHandler = new CommandHandler(
63-
/* repoToken */ "",
63+
/* repoToken */ "-token-",
6464
/* commandName */ "format",
6565
/* addReaction */ false,
6666
/* reactionType */ "+1",
@@ -77,7 +77,7 @@ describe("commandHandler", () => {
7777
context.payload = require(join(__dirname, "payloads", "created.json"));
7878

7979
const commandHandler = new CommandHandler(
80-
/* repoToken */ "",
80+
/* repoToken */ "-token-",
8181
/* commandName */ "test",
8282
/* addReaction */ false,
8383
/* reactionType */ "+1",
@@ -98,7 +98,7 @@ describe("commandHandler", () => {
9898
context.payload = require(join(__dirname, "payloads", "created.json"));
9999

100100
const commandHandler = new CommandHandler(
101-
/* repoToken */ "",
101+
/* repoToken */ "-token-",
102102
/* commandName */ "test",
103103
/* addReaction */ false,
104104
/* reactionType */ "+1",
@@ -124,7 +124,7 @@ describe("commandHandler", () => {
124124
context.payload = require(join(__dirname, "payloads", "created.json"));
125125

126126
const commandHandler = new CommandHandler(
127-
/* repoToken */ "",
127+
/* repoToken */ "-token-",
128128
/* commandName */ "test",
129129
/* addReaction */ true,
130130
/* reactionType */ "eyes",
@@ -152,7 +152,7 @@ describe("commandHandler", () => {
152152
context.payload = require(join(__dirname, "payloads", "created.json"));
153153

154154
const commandHandler = new CommandHandler(
155-
/* repoToken */ "",
155+
/* repoToken */ "-token-",
156156
/* commandName */ "test",
157157
/* addReaction */ false,
158158
/* reactionType */ "+1",
@@ -178,7 +178,7 @@ describe("commandHandler", () => {
178178
context.payload = require(join(__dirname, "payloads", "created.json"));
179179

180180
const commandHandler = new CommandHandler(
181-
/* repoToken */ "",
181+
/* repoToken */ "-token-",
182182
/* commandName */ "format",
183183
/* addReaction */ false,
184184
/* reactionType */ "+1",
@@ -255,7 +255,7 @@ describe("commandHandler", () => {
255255
context.payload = require(join(__dirname, "payloads", "created.json"));
256256

257257
const commandHandler = new CommandHandler(
258-
/* repoToken */ "",
258+
/* repoToken */ "-token-",
259259
/* commandName */ "format",
260260
/* addReaction */ false,
261261
/* reactionType */ "+1",
@@ -281,7 +281,7 @@ describe("commandHandler", () => {
281281

282282
it("skips reaction if disabled", async () => {
283283
const commandHandler = new CommandHandler(
284-
/* repoToken */ "",
284+
/* repoToken */ "-token-",
285285
/* commandName */ "format",
286286
/* addReaction */ false,
287287
/* reactionType */ "eyes",
@@ -294,7 +294,7 @@ describe("commandHandler", () => {
294294

295295
it("creates reaction if enabled", async () => {
296296
const commandHandler = new CommandHandler(
297-
/* repoToken */ "",
297+
/* repoToken */ "-token-",
298298
/* commandName */ "format",
299299
/* addReaction */ true,
300300
/* reactionType */ "eyes",

jest.config.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
module.exports = {
22
clearMocks: true,
3-
collectCoverage: true,
4-
collectCoverageFrom: [
5-
"**/*.ts",
6-
"!lib/**",
7-
"!**/node_modules/**",
8-
],
9-
coverageDirectory: "./coverage/",
103
moduleFileExtensions: ["js", "ts"],
114
testEnvironment: "node",
125
testMatch: ["**/*.test.ts"],
@@ -16,3 +9,11 @@ module.exports = {
169
},
1710
verbose: true,
1811
};
12+
13+
const processStdoutWrite = process.stdout.write.bind(process.stdout);
14+
15+
process.stdout.write = (str, encoding, cb) => {
16+
if (!str.match(/^::/)) {
17+
return processStdoutWrite(str, encoding, cb);
18+
}
19+
};

0 commit comments

Comments
 (0)