Missing pull_request_target.* types
Bug Report
Current Behavior
app.on complains about pull_request_target events due to use of octokit/webhook for verification.
pull_request_target.opened pull_request_target.reopened pull_request_target.synchronize pull_request_target.edited
console.warn "pull_request_target.synchronize" is not a known webhook name (developer.github.com/v3/activity/events/types)
https://github.com/octokit/webhooks.js/issues/666
https://github.com/release-drafter/release-drafter/blob/e3aebd9e73094fee1a9f046928a3dea5389893b9/index.js#L25-L35
Expected behavior/code Since Probot has intention of supporting GitHub actions via https://github.com/probot/adapter-github-actions than these should not show up as warnings?
Environment
- Probot version(s): v12.2.0
- Node/npm version: node 16, npm 8.1.2
- OS: N/A
Possible Solution
Additional context/Screenshots Add any other context about the problem here. If applicable, add screenshots to help explain.
Ideally the loaded webhook types would be an extendable interface, so that https://github.com/probot/adapter-github-actions could add types for GitHub Actions-specific events.
But @octokit is currently not maintained, see https://github.com/octokit/octokit.js/discussions/620#discussioncomment-1472174, so it might take a while.
GitHub
:electric_plug: An adapter that takes a Probot app and makes it compatible with GitHub Actions - GitHub - probot/adapter-github-actions: An adapter that takes a Probot app and makes it compatible w...
Any update here? Still unmaintained?
Octokit is no longer unmaintained.
This is a not a simple task to do. If you would like to contribute, feel free to open a PR
As octokit seems to be actively maintained and with recent releases https://github.com/octokit/octokit.js/releases what is still preventing us from getting a fix on this?
GitHub
Releases · octokit/octokit.jsThe all-batteries-included GitHub SDK for Browsers, Node.js, and Deno. - octokit/octokit.js
The problem is that that is an event for GitHub actions and not Webhooks. It requires some changes and possibly new packages
Feel free to work on this yourself instead of posting an unproductive comment
According to the pull_request_target docs, its payload is identical with the corresponding pull_request event.
Considering this is purely action-specific behaviour and does not exist with webhooks. I think we can deal with this in adapter-github-actions, because from a Probot perspective, the difference basically does not exist. pull_request_target allows accessing secrets in the action definition (does not matter for probot itself), and gives privileged access to the GITHUB_TOKEN, but token privileges should not be determined by event type in my opinion.
If we go this route (just replace pull_request_target with pull_request inside adapter-github-actions), I think the implementation would be a lot easier.
What do you think?
Considering this is purely action-specific behaviour and does not exist with webhooks. I think we can deal with this in
adapter-github-actions, because from a Probot perspective, the difference basically does not exist.
Agree with that.
If we go this route (just replace
pull_request_targetwithpull_requestinsideadapter-github-actions), I think the implementation would be a lot easier.
I don't know... Mixing webhooks with actions events sounds like getting into trouble, they should ideally stay seperate, as they might have seperate types, and have seperate events.
I think a good solution to this problem would be https://github.com/octokit/webhooks.js/issues/474
Maybe I'm not seeing what you're suggesting though, I'm okay with what you think is good
I don't know... Mixing webhooks with actions events sounds like getting into trouble, they should ideally stay seperate, as they might have seperate types, and have seperate events.
You're right, there are some differences for some events.
In the case of pull_request_target, the event, according to the docs I linked, matches the pull_request webhook. So long-term, I agree with what is suggested in https://github.com/octokit/webhooks.js/issues/474.
However, the actions adapter right now does not seem to care about the differences between events and webhooks. As such, just rewriting the event type internally sounds like a "good enough" solution given the current circumstances.
Users would then just do on("pull_request") in an action using Probot and get (nearly) correct types, just as they would do now when writing an action listening for pull_requests.
I'll try to create a PR on the weekend with my proposed implementation, and we can have a look at a better long-term solution as part of https://github.com/octokit/webhooks.js/issues/474.
I think a good solution to this problem would be https://github.com/octokit/webhooks.js/issues/474
This is old, but still the right path forward I think. But given the little investment @octokit gets these days I wouldn't hold my breath. I think it would be fair to say this is out of scope for Probot, move the issue over to the adapter-github-actions repo, and open the issue up to contributions