Skip to content

Commit

Permalink
fix sha when event is pull_request_target (#115)
Browse files Browse the repository at this point in the history
* fix sha when event is pull_request_target

* 1.1.45

* changelog
  • Loading branch information
MishaKav authored Feb 4, 2023
1 parent 19b7ba6 commit e2c4b20
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 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 Pytest Coverage Comment

## [Pytest Coverage Comment 1.1.45](https://github.com/MishaKav/pytest-coverage-comment/tree/v1.1.45)

**Release Date:** 2023-02-04

#### Changes

- Fix commit sha in links when event is `pull_request_target`

## [Pytest Coverage Comment 1.1.44](https://github.com/MishaKav/pytest-coverage-comment/tree/v1.1.44)

**Release Date:** 2023-01-31
Expand Down
3 changes: 2 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17870,7 +17870,7 @@ const main = async () => {
options.repoUrl =
payload.repository?.html_url || `https://github.com/${options.repository}`;

if (eventName === 'pull_request') {
if (eventName === 'pull_request' || eventName === 'pull_request_target') {
options.commit = payload.pull_request.head.sha;
options.head = payload.pull_request.head.ref;
options.base = payload.pull_request.base.ref;
Expand Down Expand Up @@ -18047,6 +18047,7 @@ const getChangedFiles = async (options) => {

switch (eventName) {
case 'pull_request':
case 'pull_request_target':
base = payload.pull_request.base.sha;
head = payload.pull_request.head.sha;
break;
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pytest-coverage-comment",
"version": "1.1.44",
"version": "1.1.45",
"description": "Comments a pull request with the pytest code coverage badge, full report and tests summary",
"author": "Misha Kav",
"license": "MIT",
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const main = async () => {
options.repoUrl =
payload.repository?.html_url || `https://github.com/${options.repository}`;

if (eventName === 'pull_request') {
if (eventName === 'pull_request' || eventName === 'pull_request_target') {
options.commit = payload.pull_request.head.sha;
options.head = payload.pull_request.head.ref;
options.base = payload.pull_request.base.ref;
Expand Down Expand Up @@ -257,6 +257,7 @@ const getChangedFiles = async (options) => {

switch (eventName) {
case 'pull_request':
case 'pull_request_target':
base = payload.pull_request.base.sha;
head = payload.pull_request.head.sha;
break;
Expand Down

0 comments on commit e2c4b20

Please sign in to comment.