Skip to content

Missing pull_request_target.* types #86

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jetersen opened this issue Jan 12, 2022 · 9 comments
Open

Missing pull_request_target.* types #86

jetersen opened this issue Jan 12, 2022 · 9 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@jetersen
Copy link
Contributor

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)

octokit/webhooks.js#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.

@gr2m
Copy link
Contributor

gr2m commented Jan 13, 2022

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 octokit/octokit.js#620 (comment), so it might take a while.

GitHub
🔌 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...

mikemckiernan referenced this issue in NVIDIA-Merlin/.github May 14, 2022
This setting seems to trigger a warning:

```text
"pull_request_target.opened" is not a known webhook name
(https://developer.github.com/v3/activity/events/types/)
"pull_request_target.reopened" is not a known webhook name
(https://developer.github.com/v3/activity/events/types/)
"pull_request_target.synchronize" is not a known webhook name
(https://developer.github.com/v3/activity/events/types/)
"pull_request_target.edited" is not a known webhook name
(https://developer.github.com/v3/activity/events/types/)
```

See <https://github.com/probot/probot/issues/1635>.
@carmocca
Copy link

carmocca commented Sep 9, 2022

Any update here? Still unmaintained?

@wolfy1339
Copy link
Contributor

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

@ssbarnea
Copy link

ssbarnea commented Feb 12, 2025

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
The all-batteries-included GitHub SDK for Browsers, Node.js, and Deno. - octokit/octokit.js

@wolfy1339
Copy link
Contributor

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

@AaronDewes
Copy link
Member

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?

@wolfy1339
Copy link
Contributor

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_target with pull_request inside adapter-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 octokit/webhooks.js#474

Maybe I'm not seeing what you're suggesting though, I'm okay with what you think is good

@AaronDewes
Copy link
Member

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 octokit/webhooks.js#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 octokit/webhooks.js#474.

@gr2m
Copy link
Contributor

gr2m commented Feb 12, 2025

I think a good solution to this problem would be octokit/webhooks.js#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

@AaronDewes AaronDewes transferred this issue from probot/probot Feb 13, 2025
@AaronDewes AaronDewes added enhancement New feature or request help wanted Extra attention is needed labels Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants