-
Hi! I am writing a simple bot that will run status checks when a comment (something like “@MYBOT build”) is made on a pull request. I notice that when a workflow is triggered by issue_comment as the result of a comment being made on a pull request, github.ref is always refs/heads/master. What I really want is for the context to be the branch that the pull request is on so the status checks in the pull request will update accordingly. Is this a bug? If this is expected behavior, then I guess I will need to use the Statuses API explicitly to get the pull request to update properly in response to a check being run as the result of a comment. Peter |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments
-
Comments on issues and pull requests will have the I think that what you’re looking for is github.event.issue.pull_request and github.event.issue.number. |
Beta Was this translation helpful? Give feedback.
-
Yeah, thanks for the reply. I can indeed get the pull request number from the event, but I can’t get the PR ref directly from the event which means I need to do an API call to figure out what branch to checkout. Complicates the workflow but it’s doable. |
Beta Was this translation helpful? Give feedback.
-
We have a similair issue. It would be really great to have something like
that containes all the information about pull request that was commented including head_ref and base_ref |
Beta Was this translation helpful? Give feedback.
-
Trying to set this up myself now. Did you ever get it working? |
Beta Was this translation helpful? Give feedback.
-
This is what I tried,
|
Beta Was this translation helpful? Give feedback.
-
I’d suggest using this workflow package: https://github.com/Khan/pull-request-comment-trigger |
Beta Was this translation helpful? Give feedback.
-
@ethomson So I always need to merge my changes in default branch first? |
Beta Was this translation helpful? Give feedback.
Comments on issues and pull requests will have the
ref
set to the default branch. However, you should be able to inspect the full github event context for the information about the pull request in question.I think that what you’re looking for is github.event.issue.pull_request and github.event.issue.number.