Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 2

GitHub Actions - no way to get PR number on push event?

Solved! Go to Solution.

Hey there,

 

I'd like to get the commit SHA, branch, and pull request number on a push event.

 

I've found GITHUB_SHA and GITHUB_REF in the environment variables.  I don't see how to get the pull request number though.  It looks like the push event payload doesn't include the pull request number? https://developer.github.com/v3/activity/events/types/#pushevent

 

Is there some other way to get the pull request number from the environment?

 

Thanks,

 

Tim

1 Reply
Solution
GitHub Staff
Message 2 of 2

Re: GitHub Actions - no way to get PR number on push event?

Hi @timhaines 

 

I think you could get the pull request information using this recent endpoint https://developer.github.com/v3/repos/commits/#list-pull-requests-associated-with-commit using the SHA that you are getting in the payload.

 

Let me know if that works for you!