Skip to content

Commit

Permalink
support pull_request_target event to add comments (#59)
Browse files Browse the repository at this point in the history
* support pull_request_target event to add comments (#58)

* support pull_request_target event to add comments

* update warning for the case pull_request_target

* update build

* formatting

* bump dev dependencies

* 1.0.22

* changelog

Co-authored-by: Chirag Madlani <[email protected]>
  • Loading branch information
MishaKav and chirag-madlani authored Jan 7, 2023
1 parent f2059b3 commit c0e038b
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 72 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog of the Jest Coverage Comment

## [Jest Coverage Comment 1.0.22](https://github.com/MishaKav/jest-coverage-comment/tree/v1.0.22)

**Release Date:** 2023-01-07

#### Changes

- Support `pull_request_target` event to add comments, thanks to [@chirag-madlani](https://github.com/chirag-madlani) for contribution

## [Jest Coverage Comment 1.0.21](https://github.com/MishaKav/jest-coverage-comment/tree/v1.0.21)

**Release Date:** 2022-12-03
Expand Down
5 changes: 3 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

126 changes: 63 additions & 63 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jest-coverage-comment",
"version": "1.0.21",
"version": "1.0.22",
"description": "Comments a pull request or commit with the jest code coverage badge, full report and tests summary",
"author": "Misha Kav <[email protected]>",
"license": "MIT",
Expand Down Expand Up @@ -39,15 +39,15 @@
"@types/jest": "^29.2.5",
"@types/node": "^18.11.18",
"@types/xml2js": "^0.4.11",
"@typescript-eslint/parser": "^5.47.1",
"@typescript-eslint/parser": "^5.48.0",
"@vercel/ncc": "^0.36.0",
"babel-plugin-rewire": "^1.2.0",
"eslint": "^8.31.0",
"eslint-import-resolver-typescript": "^3.5.2",
"eslint-plugin-github": "^4.6.0",
"eslint-plugin-jest": "^27.2.0",
"eslint-plugin-jest": "^27.2.1",
"jest-junit": "^15.0.0",
"prettier": "^2.8.1",
"prettier": "^2.8.2",
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"typescript": "^4.9.4"
Expand Down
7 changes: 5 additions & 2 deletions src/create-comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ export async function createComment(
commit_sha: options.commit,
body,
})
} else if (eventName === 'pull_request') {
} else if (
eventName === 'pull_request' ||
eventName === 'pull_request_target'
) {
if (options.createNewComment) {
core.info('Creating a new comment')

Expand Down Expand Up @@ -98,7 +101,7 @@ export async function createComment(
} else {
if (!options.hideComment) {
core.warning(
`This action supports comments only on 'pull_request' and 'push' events. '${eventName}' events are not supported.\nYou can use the output of the action.`
`This action supports comments only on 'pull_request', 'pull_request_target' and 'push' events. '${eventName}' events are not supported.\nYou can use the output of the action.`
)
}
}
Expand Down

0 comments on commit c0e038b

Please sign in to comment.