diff --git a/README.md b/README.md index 83c1550..da61c1b 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,8 @@ Name | Decription `base_sha` | The head sha of the branch the pull request will merge into. `head_ref` | The name of the pull request branch the comment belongs to. `head_sha` | The head sha of the pull request branch the comment belongs to. +`head_owner` | The owner of the pull request branch the comment belongs to. +`head_repo` | The repository of the pull request branch the comment belongs to. `ref` | Deprecated, use `head_ref` instead. `sha` | Deprecated, use `head_sha` instead. diff --git a/action.yml b/action.yml index 6f68360..1677988 100644 --- a/action.yml +++ b/action.yml @@ -23,6 +23,10 @@ outputs: description: "The name of the pull request branch the comment belongs to." head_sha: description: "The head sha of the pull request branch the comment belongs to." + head_owner: + description: "The owner of the pull request branch the comment belongs to." + head_repo: + description: "The repository of the pull request branch the comment belongs to." # deprecated outputs ref: description: "Deprecated, use head_ref instead." diff --git a/src/PullRequests.ts b/src/PullRequests.ts index 59c4b1d..0555fa6 100644 --- a/src/PullRequests.ts +++ b/src/PullRequests.ts @@ -15,6 +15,12 @@ interface PullRequestDetailsResponse { oid: string; }; }; + headRepository: { + name: string; + owner: { + login: string; + }; + } }; }; } @@ -38,6 +44,7 @@ export async function pullRequestDetails(token: string) { pullRequest: { baseRef, headRef, + headRepository, }, }, } = await client.graphql( @@ -57,6 +64,12 @@ export async function pullRequestDetails(token: string) { oid } } + headRepository { + name + owner { + login + } + } } } } @@ -72,5 +85,7 @@ export async function pullRequestDetails(token: string) { base_sha: baseRef.target.oid, head_ref: headRef.name, head_sha: headRef.target.oid, + head_repo: headRepository.name, + head_owner: headRepository.owner.login, }; } diff --git a/src/main.ts b/src/main.ts index 7b71457..b12838e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -15,12 +15,16 @@ export async function run() { base_sha, head_ref, head_sha, + head_repo, + head_owner, } = await pullRequestDetails(token); setOutput("base_ref", base_ref); setOutput("base_sha", base_sha); setOutput("head_ref", head_ref); setOutput("head_sha", head_sha); + setOutput("head_repo", head_repo); + setOutput("head_owner", head_owner); // Deprecated setOutput("ref", head_ref);