diff --git a/gh-act b/gh-act index 3e2db4a..d5374fa 100755 --- a/gh-act +++ b/gh-act @@ -583,6 +583,11 @@ function issue_event_envs() { fi ISSUE_COMMENT_USER_JSON=$(user_json "${ISSUE_COMMENT_AUTHOR}") fi + + if [[ "${ISSUE_URL}" =~ .*pull.* ]]; then + ISSSUE_PULL_REQUEST_JSON=$(parts_json issue_pull_request) + fi + HEAD_OWNER="${OWNER}" HEAD_REPO="${REPO}" HEAD_USER="${ISSUE_AUTHOR}" diff --git a/templates/issue_comment.json b/templates/issue_comment.json index c10600c..44e0129 100644 --- a/templates/issue_comment.json +++ b/templates/issue_comment.json @@ -4,9 +4,9 @@ "author_association": "${ISSUE_COMMENT_AUTHOR_ASSOCIATION}", "body": "${ISSUE_COMMENT_BODY}", "created_at": "${ISSUE_COMMENT_CREATED_AT}", - "html_url": "https://${GITHUB_HOSTNAME}/${OWNER}/${REPO}/issues/${ISSUE_NUMBER}#issuecomment-${ISSUE_COMMENT_ID}", + "html_url": "https://${GITHUB_HOSTNAME}/${OWNER}/${REPO}/issues/${GHACT_ISSUE_NUMBER}#issuecomment-${ISSUE_COMMENT_ID}", "id": ${ISSUE_COMMENT_ID}, - "issue_url": "https://${GITHUB_API}/repos/${OWNER}/${REPO}/issues/${ISSUE_NUMBER}", + "issue_url": "https://${GITHUB_API}/repos/${OWNER}/${REPO}/issues/${GHACT_ISSUE_NUMBER}", "node_id": "", "performed_via_github_app": null, "reactions": { diff --git a/templates/parts/issue.json b/templates/parts/issue.json index fd5397b..5a98ab4 100644 --- a/templates/parts/issue.json +++ b/templates/parts/issue.json @@ -18,6 +18,7 @@ "node_id": "${ISSUE_NODE_ID}", "number": ${ISSUE_NUMBER}, "performed_via_github_app": null, + "pull_request": ${ISSSUE_PULL_REQUEST_JSON:-null}, "reactions": { "+1": ${ISSUE_REACTION_THUMBS_UP_COUNT:-0}, "-1": ${ISSUE_REACTION_THUMBS_DOWN_COUNT:-0}, diff --git a/templates/parts/issue_pull_request.json b/templates/parts/issue_pull_request.json new file mode 100644 index 0000000..a4c6175 --- /dev/null +++ b/templates/parts/issue_pull_request.json @@ -0,0 +1,7 @@ +{ + "diff_url": "${ISSUE_URL}.diff", + "html_url": "${ISSUE_URL}", + "merged_at": null, + "patch_url": "${ISSUE_URL}.patch", + "url": "https://${GITHUB_API}/repos/${OWNER}/${REPO}/pulls/${GHACT_ISSUE_NUMBER}" +}