Skip to content

Commit 08b90af

Browse files
authored
Merge pull request #27 from peter-evans/typescript
refactor: convert to typescript
2 parents a0a9785 + e4fac8d commit 08b90af

16 files changed

+4633
-5867
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

+18-16
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
{
2-
"env": {
3-
"commonjs": true,
4-
"es6": true,
5-
"node": true
6-
},
7-
"extends": "eslint:recommended",
8-
"globals": {
9-
"Atomics": "readonly",
10-
"SharedArrayBuffer": "readonly"
11-
},
12-
"parserOptions": {
13-
"ecmaVersion": 2018
14-
},
15-
"rules": {
16-
}
17-
}
2+
"env": { "node": true, "jest": true },
3+
"parser": "@typescript-eslint/parser",
4+
"parserOptions": { "ecmaVersion": 9, "sourceType": "module" },
5+
"extends": [
6+
"eslint:recommended",
7+
"plugin:@typescript-eslint/eslint-recommended",
8+
"plugin:@typescript-eslint/recommended",
9+
"plugin:import/errors",
10+
"plugin:import/warnings",
11+
"plugin:import/typescript",
12+
"plugin:prettier/recommended",
13+
"prettier/@typescript-eslint"
14+
],
15+
"plugins": ["@typescript-eslint"],
16+
"rules": {
17+
"@typescript-eslint/camelcase": "off"
18+
}
19+
}

.github/workflows/ci.yml

+24-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ jobs:
1919
with:
2020
node-version: 12.x
2121
- run: npm ci
22+
- run: npm run build
23+
- run: npm run format-check
24+
- run: npm run lint
2225
- run: npm run test
23-
- run: npm run package
2426
- uses: actions/upload-artifact@v2
2527
with:
2628
name: dist
@@ -57,6 +59,8 @@ jobs:
5759
body-includes: search string 1
5860
- if: steps.fc1.outputs.comment-id != 620947762
5961
run: exit 1
62+
- if: steps.fc1.outputs.comment-body != 'search string 1'
63+
run: exit 1
6064

6165
- name: Find comment by author
6266
uses: ./
@@ -87,6 +91,24 @@ jobs:
8791
- if: steps.fc4.outputs.comment-id != ''
8892
run: exit 1
8993

94+
- name: Find comment by body-includes (requiring pagination)
95+
uses: ./
96+
id: fc5
97+
with:
98+
issue-number: 1
99+
body-includes: search string 2
100+
- if: steps.fc5.outputs.comment-id != 703343658
101+
run: exit 1
102+
103+
- name: Find comment in merged PR
104+
uses: ./
105+
id: fc6
106+
with:
107+
issue-number: 4
108+
body-includes: search string 3
109+
- if: steps.fc6.outputs.comment-id != 703352283
110+
run: exit 1
111+
90112
package:
91113
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
92114
needs: [test]
@@ -100,7 +122,7 @@ jobs:
100122
- name: Create Pull Request
101123
uses: peter-evans/create-pull-request@v3
102124
with:
103-
commit-message: Update distribution
125+
commit-message: 'build: update distribution'
104126
title: Update distribution
105127
body: |
106128
- Updates the distribution for changes on `master`

.github/workflows/update-dep.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
uses: peter-evans/create-pull-request@v3
1919
with:
2020
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
21-
commit-message: Update dependencies
21+
commit-message: 'chore: update dependencies'
2222
committer: GitHub <[email protected]>
2323
author: actions-bot <[email protected]>
2424
title: Update dependencies

.gitignore

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

.prettierignore

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

.prettierrc.json

+11
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+
}

README.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ The action will output the comment ID of the first comment matching the search c
4747
| Name | Description | Default |
4848
| --- | --- | --- |
4949
| `token` | `GITHUB_TOKEN` or a `repo` scoped [PAT](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token). | `GITHUB_TOKEN` |
50-
| `repository` | The full name of the repository containing the issue or pull request. | Current repository |
50+
| `repository` | The full name of the repository containing the issue or pull request. | `github.repository` (Current repository) |
5151
| `issue-number` | The number of the issue or pull request in which to search. | |
5252
| `comment-author` | The GitHub user name of the comment author. | |
5353
| `body-includes` | A string to search for in the body of comments. | |
5454

5555
#### Outputs
5656

57-
The ID of the first matching comment found will be output for use in later steps.
58-
Note that in order to read the step output the action step must have an id.
57+
The `comment-id` and `comment-body` of the first matching comment found will be output for use in later steps.
58+
Note that in order to read the step outputs the action step must have an id.
5959

6060
```yml
6161
- name: Find Comment
@@ -64,7 +64,9 @@ Note that in order to read the step output the action step must have an id.
6464
with:
6565
issue-number: 1
6666
body-includes: search string 1
67-
- run: echo ${{ steps.fc.outputs.comment-id }}
67+
- run: |
68+
echo ${{ steps.fc.outputs.comment-id }}
69+
echo ${{ steps.fc.outputs.comment-body }}
6870
```
6971

7072
### Accessing issues and pull requests in other repositories

action.yml

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ inputs:
66
default: ${{ github.token }}
77
repository:
88
description: 'The full name of the repository containing the issue or pull request.'
9+
default: ${{ github.repository }}
910
issue-number:
1011
description: 'The number of the issue or pull request in which to search.'
1112
comment-author:

0 commit comments

Comments
 (0)