Help: PR status update in workflow invoked via comment #25141
-
Howdy everyone 🙋♂️ Trying to create a workflow that will run some tests when a PR comment is left. The goal is to have the workflow show up on the PR as a status check as well.
In the example above, the workflow is triggered with a comment, however it doesn’t show up as a status check for the PR. Any help here would be appreciated - thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
Hi @zimventures , It’s not supported. Comment for pull request will not create new commit for the repository. According to the status rest api here, you need to have an commit sha firstly, then you can add status to the pull request. Besides, you cannot get the workflow status itself since it’s not completed. Thanks. |
Beta Was this translation helpful? Give feedback.
-
Why can’t it just assume the last commit SHA as the target for the status update? There are certainly plenty of examples out there of actions that perform this type of thing. You’d think it would be allowed directly within a workflow. |
Beta Was this translation helpful? Give feedback.
-
Hi @zimventures , Thanks for your reply! Yes, as an alternative, you can use the last commit in the pull request as the SHA for status creation. And transfer the test result as ‘success, failure…etc’ to API body. |
Beta Was this translation helpful? Give feedback.
-
Hi @weide-zhou , I’m a little confused as to what you’re suggesting or showing in your example. Could you please provide the source code? It’s unclear if you’re suggesting that this is something that can happen within the workflow of if you’re using the GitHub API directly to add status messages to the PR. Thanks. |
Beta Was this translation helpful? Give feedback.
-
Hi @zimventures , This can be completed in the workflow with rest api. Code sample as below:
Note:
Thanks. |
Beta Was this translation helpful? Give feedback.
Hi @zimventures ,
This can be completed in the workflow with rest api. Code sample as below: