Skip to content

Commit

Permalink
Merge pull request #27 from peter-evans/typescript
Browse files Browse the repository at this point in the history
refactor: convert to typescript
  • Loading branch information
peter-evans authored Oct 5, 2020
2 parents a0a9785 + e4fac8d commit 08b90af
Show file tree
Hide file tree
Showing 16 changed files with 4,633 additions and 5,867 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/
lib/
node_modules/
34 changes: 18 additions & 16 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
{
"env": {
"commonjs": true,
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018
},
"rules": {
}
}
"env": { "node": true, "jest": true },
"parser": "@typescript-eslint/parser",
"parserOptions": { "ecmaVersion": 9, "sourceType": "module" },
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:prettier/recommended",
"prettier/@typescript-eslint"
],
"plugins": ["@typescript-eslint"],
"rules": {
"@typescript-eslint/camelcase": "off"
}
}
26 changes: 24 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ jobs:
with:
node-version: 12.x
- run: npm ci
- run: npm run build
- run: npm run format-check
- run: npm run lint
- run: npm run test
- run: npm run package
- uses: actions/upload-artifact@v2
with:
name: dist
Expand Down Expand Up @@ -57,6 +59,8 @@ jobs:
body-includes: search string 1
- if: steps.fc1.outputs.comment-id != 620947762
run: exit 1
- if: steps.fc1.outputs.comment-body != 'search string 1'
run: exit 1

- name: Find comment by author
uses: ./
Expand Down Expand Up @@ -87,6 +91,24 @@ jobs:
- if: steps.fc4.outputs.comment-id != ''
run: exit 1

- name: Find comment by body-includes (requiring pagination)
uses: ./
id: fc5
with:
issue-number: 1
body-includes: search string 2
- if: steps.fc5.outputs.comment-id != 703343658
run: exit 1

- name: Find comment in merged PR
uses: ./
id: fc6
with:
issue-number: 4
body-includes: search string 3
- if: steps.fc6.outputs.comment-id != 703352283
run: exit 1

package:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: [test]
Expand All @@ -100,7 +122,7 @@ jobs:
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
commit-message: Update distribution
commit-message: 'build: update distribution'
title: Update distribution
body: |
- Updates the distribution for changes on `master`
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-dep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
commit-message: Update dependencies
commit-message: 'chore: update dependencies'
committer: GitHub <[email protected]>
author: actions-bot <[email protected]>
title: Update dependencies
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
lib/
node_modules/
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/
lib/
node_modules/
11 changes: 11 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": false,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid",
"parser": "typescript"
}
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ The action will output the comment ID of the first comment matching the search c
| Name | Description | Default |
| --- | --- | --- |
| `token` | `GITHUB_TOKEN` or a `repo` scoped [PAT](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token). | `GITHUB_TOKEN` |
| `repository` | The full name of the repository containing the issue or pull request. | Current repository |
| `repository` | The full name of the repository containing the issue or pull request. | `github.repository` (Current repository) |
| `issue-number` | The number of the issue or pull request in which to search. | |
| `comment-author` | The GitHub user name of the comment author. | |
| `body-includes` | A string to search for in the body of comments. | |

#### Outputs

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

```yml
- name: Find Comment
Expand All @@ -64,7 +64,9 @@ Note that in order to read the step output the action step must have an id.
with:
issue-number: 1
body-includes: search string 1
- run: echo ${{ steps.fc.outputs.comment-id }}
- run: |
echo ${{ steps.fc.outputs.comment-id }}
echo ${{ steps.fc.outputs.comment-body }}
```

### Accessing issues and pull requests in other repositories
Expand Down
1 change: 1 addition & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ inputs:
default: ${{ github.token }}
repository:
description: 'The full name of the repository containing the issue or pull request.'
default: ${{ github.repository }}
issue-number:
description: 'The number of the issue or pull request in which to search.'
comment-author:
Expand Down
Loading

0 comments on commit 08b90af

Please sign in to comment.