Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/github/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/github",
"version": "1.6.2",
"version": "1.7.0",
"description": "Pipedream Github Components",
"main": "github.app.mjs",
"keywords": [
Expand Down
103 changes: 103 additions & 0 deletions components/github/sources/new-issue-comment/common-sample-events.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import { SAMPLE_GITHUB_HEADERS } from "../common/constants.mjs";

export function getSampleWebhookEvent() {
return {
...SAMPLE_GITHUB_HEADERS,
"url": "https://api.github.com/repos/user/repo/issues/comments/2675481838",
"html_url": "https://github.com/user/repo/issues/8#issuecomment-2675481838",
"issue_url": "https://api.github.com/repos/user/repo/issues/8",
"id": 2675481838,
"node_id": "IC_kwDOAmjbCM6feJzu",
"user": {
"login": "user",
"id": 10889229,
"node_id": "MDQ6VXNlcjEwODg5MjI5",
"avatar_url": "https://avatars.githubusercontent.com/u/10889229?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/user",
"html_url": "https://github.com/user",
"followers_url": "https://api.github.com/users/user/followers",
"following_url": "https://api.github.com/users/user/following{/other_user}",
"gists_url": "https://api.github.com/users/user/gists{/gist_id}",
"starred_url": "https://api.github.com/users/user/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/user/subscriptions",
"organizations_url": "https://api.github.com/users/user/orgs",
"repos_url": "https://api.github.com/users/user/repos",
"events_url": "https://api.github.com/users/user/events{/privacy}",
"received_events_url": "https://api.github.com/users/user/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false,
},
"created_at": "2025-02-21T20:29:49Z",
"updated_at": "2025-02-21T20:29:49Z",
"author_association": "OWNER",
"body": "hello world",
"reactions": {
"url": "https://api.github.com/repos/user/repo/issues/comments/2675481838/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0,
},
"performed_via_github_app": null,
"github_headers": {
"x-github-delivery": "99a89b30-f092-11ef-80fb-37d0e2023dc5",
"x-github-event": "issue_comment",
"x-github-hook-id": "531386725",
},
};
}

export function getSampleTimerEvent() {
return {
"url": "https://api.github.com/repos/user/repo/issues/comments/2675511709",
"html_url": "https://github.com/user/repo/issues/8#issuecomment-2675511709",
"issue_url": "https://api.github.com/repos/user/repo/issues/8",
"id": 2675511709,
"node_id": "IC_kwDOAmjbCM6feRGd",
"user": {
"login": "user",
"id": 10889229,
"node_id": "MDQ6VXNlcjEwODg5MjI5",
"avatar_url": "https://avatars.githubusercontent.com/u/10889229?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/user",
"html_url": "https://github.com/user",
"followers_url": "https://api.github.com/users/user/followers",
"following_url": "https://api.github.com/users/user/following{/other_user}",
"gists_url": "https://api.github.com/users/user/gists{/gist_id}",
"starred_url": "https://api.github.com/users/user/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/user/subscriptions",
"organizations_url": "https://api.github.com/users/user/orgs",
"repos_url": "https://api.github.com/users/user/repos",
"events_url": "https://api.github.com/users/user/events{/privacy}",
"received_events_url": "https://api.github.com/users/user/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false,
},
"created_at": "2025-02-21T20:48:06Z",
"updated_at": "2025-02-21T20:48:06Z",
"author_association": "OWNER",
"body": "hello world",
"reactions": {
"url": "https://api.github.com/repos/user/repo/issues/comments/2675511709/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0,
},
"performed_via_github_app": null,
};
}
46 changes: 46 additions & 0 deletions components/github/sources/new-issue-comment/new-issue-comment.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import common from "../common/common-flex.mjs";
import {
getSampleTimerEvent, getSampleWebhookEvent,
} from "./common-sample-events.mjs";

export default {
...common,
key: "github-new-issue-comment",
name: "New Issue Comment",
description: "Emit new event when a new comment is added to an issue or pull request",
version: "0.0.1",
type: "source",
dedupe: "unique",
methods: {
...common.methods,
getSampleWebhookEvent,
getSampleTimerEvent,
getWebhookEvents() {
return [
"issue_comment",
];
},
shouldEmitWebhookEvent(body) {
return body?.action === "created";
},
getWebhookEventItem(body) {
return body.comment;
},
getSummary(item) {
return `New comment: ${this.getId(item)}`;
},
async getPollingData({ repoFullname }) {
const { data } = await this.github._client().request(`GET /repos/${repoFullname}/issues/comments`, {
sort: "created",
direction: "desc",
});
return data;
},
getHttpDocsLink() {
return "https://docs.github.com/en/webhooks/webhook-events-and-payloads#issue_comment";
},
getTimerDocsLink() {
return "https://docs.github.com/en/rest/issues/comments?apiVersion=2022-11-28#list-issue-comments-for-a-repository";
},
},
};
Loading