octokit / octokit.js

The all-batteries-included GitHub SDK for Browsers, Node.js, and Deno.
MIT License
7.01k stars 1.03k forks source link

Ignore webhook labeled event if issue was just created #2444

Closed faisalsayed10 closed 1 year ago

faisalsayed10 commented 1 year ago

What happened?

Is there a way to ignore the issues.labeled webhook, if I labeled the issue during creation?

The problem is: I have two webhook listeners set up - issues.opened and issues.labeled. Now, when I create an issue on Github, I add some labels during creation and then hit create.

However, this results in both the webhooks being called and leads to duplicate errors on our backend, i.e issues.opened and issues.labeled. Is there a way I can ignore the labeled event if it happened during issue creation?

Versions

"@octokit/webhooks": "^10.9.1"

Relevant log output

No response

Code of Conduct

wolfy1339 commented 1 year ago

You can handle the issue.opened event and keep a record of the issue then check in the issue.labelled event if you have seen it for the opened event.

Otherwise, there isn't a way. It's how github sends the webhooks

faisalsayed10 commented 1 year ago

Ah i see. Cool I'll close this issue.