Skip to content

Commit 9495550

Browse files
committed
filter pull_request_review events by state
1 parent 2fab769 commit 9495550

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

components/github/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/github",
3-
"version": "1.4.0",
3+
"version": "1.4.1",
44
"description": "Pipedream Github Components",
55
"main": "github.app.mjs",
66
"keywords": [

components/github/sources/common/constants.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,11 @@ export default {
349349
value: "opened",
350350
},
351351
],
352+
PULL_REQUEST_REVIEW_STATES: [
353+
"approved",
354+
"changes_requested",
355+
"commented",
356+
],
352357
};
353358

354359
export const SAMPLE_GITHUB_HEADERS = {

components/github/sources/webhook-events/webhook-events.mjs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ export default {
88
name: "New Webhook Event (Instant)",
99
description: "Emit new event for each selected event type",
1010
type: "source",
11-
version: "1.0.5",
11+
version: "1.0.6",
12+
dedupe: "unique",
1213
props: {
1314
docsInfo: {
1415
type: "alert",
@@ -21,9 +22,23 @@ export default {
2122
description: "The event types to be emitted",
2223
type: "string[]",
2324
options: constants.REPOSITORY_WEBHOOK_EVENTS,
25+
reloadProps: true,
2426
},
2527
},
26-
dedupe: "unique",
28+
async additionalProps() {
29+
await this.requireAdminPermission();
30+
const props = {};
31+
if (this.events?.length && this.events.includes("pull_request_review")) {
32+
props.reviewState = {
33+
type: "string",
34+
label: "Review State",
35+
description: "Filter `pull_request_review` events by review state",
36+
options: constants.PULL_REQUEST_REVIEW_STATES,
37+
optional: true,
38+
};
39+
}
40+
return props;
41+
},
2742
methods: {
2843
...common.methods,
2944
getWebhookEvents() {
@@ -42,6 +57,10 @@ export default {
4257
return;
4358
}
4459

60+
if (headers["x-github-event"] === "pull_request_review" && this.reviewState && body.review.state !== this.reviewState) {
61+
return;
62+
}
63+
4564
this.$emit({
4665
...getRelevantHeaders(headers),
4766
...body,

0 commit comments

Comments
 (0)