Any way to checkout PR from `issue_comment` event?
See original GitHub issueThe example in the docs here assumes a pull request event, but it does not work when operating on Pull Request comments, since those come through the issue_comment
event.
I’ve spent several hours on this now and I don’t see any way to checkout the branch associated with the issue_event.
Complications:
- The event is the comment and it links to an issue, which only indirectly seems to have data on the pull request url.
- Checking out the associate sha doesn’t give push ability, since the branch name itself is not discoverable (at least not as well as I can tell).
- Since
issue_comment
events have to be triggered by the workflow file on the default branch, it seems that is always the branch name provided. I haven’t yet found any way to get the actual PR branch, although it seems this should be a straightforward and frequent use case for operating on PR comments.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:35
- Comments:19
Top Results From Across the Web
GitHub action for issue_comment doesn't shown in checks for ...
Basically you need to checkout to the PR origin. For that, first make a API request to the pr url and fetch all...
Read more >Run GitHub Actions on Issue Comments - PäksTech
Checkout the correct commit. Since the issue comment event runs against the main branch we need to figure out a way to checkout...
Read more >How To Checkout Git Pull Request In Three Easy Steps
First, get the pull request number from the Pull request details. It you are using Github, you can easily get the pull request...
Read more >octokit/rest.js
We recommend to use the search above to find the endpoint method you are looking ... Authentication is optional for some REST API...
Read more >544815 – Support Github pull request integration ... - Bugs
There is already code for some PR-related commands (checkout PR, merge PR, ... namespace is read-only, so you can't push new commits onto...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As the required information isn’t present in the event payload, you could use the GitHub API to fetch it. The github-script action allows you to write actions in your workflow file, which is pretty convenient:
This has worked for us!