Skip to content
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

[pull] master from PipedreamHQ:master #1

Merged
merged 67 commits into from
Aug 13, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
e25a004
3903 readwise - New Features (#3915)
luancazarine Aug 2, 2022
e8e76b6
Discord - new actions & triggers/sources (#3898)
michelle0927 Aug 2, 2022
a7fcbc6
Fix data stores object parsing (#3895)
andrewjschuang Aug 2, 2022
5895ed2
#983 - Infusionsoft Actions & Sources (#3870)
GTFalcao Aug 2, 2022
29be4f3
[BUG] Datadog - New Monitor Event Trigger async options broken #3459 …
lcaresia Aug 2, 2022
4ae7e04
Bugfix - Monday.com (#3874)
vellames Aug 3, 2022
d745c6d
fix mediaIds prop (#3896)
luancazarine Aug 3, 2022
d0db2af
[SOURCE] Slack - New Star Added (#3526)
vellames Aug 3, 2022
5ed1c19
Fixing old migration guide docs
ctrlaltdylan Aug 3, 2022
68d3177
Adding PoC auth and data store docs (#3892)
ctrlaltdylan Aug 3, 2022
00c3c2f
Modifying global config
dylburger Aug 4, 2022
3261759
Adding app scaffolding for looker
dylburger Aug 4, 2022
46760b7
Adding app scaffolding for looker
dylburger Aug 4, 2022
5859579
Adding app scaffolding for looker
dylburger Aug 4, 2022
096f627
eSignatures.io #3857 (#3918)
lcaresia Aug 4, 2022
3a5f2b2
Adding context, rerun, respond python docs (#3933)
ctrlaltdylan Aug 4, 2022
c3d9faf
RSS - add random item source (#3931)
andrewjschuang Aug 4, 2022
0b7d4eb
add optional title and description (#3930)
andrewjschuang Aug 4, 2022
175d700
Twitter Simple Search in List (#3922)
feyzullah Aug 4, 2022
e5bfd80
RingCentral Source Issues (#3942)
andrewjschuang Aug 5, 2022
43a5987
Remove "ignore myself" from Discord New Message trigger (#3941)
js07 Aug 5, 2022
8ca1469
Slack: remove "ignore myself" from sources(#3944)
js07 Aug 5, 2022
25c47f2
Update dateTime format (#3948)
wernersa Aug 8, 2022
ded46c7
3778 short.io actions (#3925)
alysonturing Aug 8, 2022
579d482
Bump rojopolis/spellcheck-github-actions from 0.25.0 to 0.26.0 (#3954)
dependabot[bot] Aug 8, 2022
8a66904
Fix elmah.io source (#3956)
ThomasArdal Aug 8, 2022
af7e7e6
awork #3855 (#3923)
lcaresia Aug 8, 2022
710a8e7
Modifying global config
dylburger Aug 8, 2022
b7ed015
Adding app scaffolding for ethereum
dylburger Aug 8, 2022
d17d88a
Adding app scaffolding for ethereum
dylburger Aug 8, 2022
8824a78
Adding app scaffolding for ethereum
dylburger Aug 8, 2022
563c0fb
Adding app scaffolding for sendle
dylburger Aug 8, 2022
70e85fb
Adding app scaffolding for sendle
dylburger Aug 8, 2022
53e6483
Adding app scaffolding for sendle
dylburger Aug 8, 2022
4b925ec
GitHub - Add GET request to certain Instant Webhook-Based Sources (#3…
michelle0927 Aug 9, 2022
9b69f84
[Actions/SourcesFeature/new relic 3699 (#3943)
vellames Aug 9, 2022
0460719
add readme troubleshooting section (#3967)
andrewjschuang Aug 9, 2022
276930d
Rename readme.md to README.md (#3968)
michelle0927 Aug 9, 2022
702e4cb
Adding notion create page from database docs
ctrlaltdylan Aug 9, 2022
c4f7d70
rename new-deployment source (#3970)
michelle0927 Aug 9, 2022
3dd2faa
Twitter - new sources for users/lists followed (#3963)
michelle0927 Aug 9, 2022
c74a33f
Modifying global config
dylburger Aug 10, 2022
1bf7403
Adding app scaffolding for google_workspace
dylburger Aug 10, 2022
841f6fa
Adding app scaffolding for google_workspace
dylburger Aug 10, 2022
190945d
Adding app scaffolding for google_workspace
dylburger Aug 10, 2022
b4ec506
Workast #3839 (#3962)
lcaresia Aug 10, 2022
18429b5
YouCanBook.Me #3847 (#3955)
lcaresia Aug 10, 2022
1a84c37
Modifying global config
dylburger Aug 10, 2022
0037abe
Adding app scaffolding for cartes
dylburger Aug 10, 2022
fc552f4
Adding app scaffolding for cartes
dylburger Aug 10, 2022
295fec5
Adding app scaffolding for cartes
dylburger Aug 10, 2022
f96682f
3646 html css to image (#3973)
alysonturing Aug 11, 2022
745b2d0
OneDrive - Get table from Excel spreadsheet (#3978)
JohnR-LoD Aug 11, 2022
22b245f
Fix axios debug export printing (#3913)
andrewjschuang Aug 12, 2022
2433f32
Fixing missing export default
ctrlaltdylan Aug 12, 2022
11506bf
3900 action hubspot enroll in a workflow or a sequence (#3984)
luancazarine Aug 12, 2022
0f53280
Thanks.io - new actions and sources/triggers (#3908)
michelle0927 Aug 12, 2022
2b50493
Salesforce - Refactor sources to be resilient to timeouts (#3971)
michelle0927 Aug 12, 2022
2f2f270
WebinarGeek #3835 (#3987)
lcaresia Aug 12, 2022
b1f338a
Modifying global config
dylburger Aug 12, 2022
c8ce4aa
Adding app scaffolding for dictionary_api
dylburger Aug 12, 2022
a17025e
Adding app scaffolding for dictionary_api
dylburger Aug 12, 2022
52a27aa
Adding app scaffolding for dictionary_api
dylburger Aug 12, 2022
f5774c3
Modifying global config
dylburger Aug 12, 2022
d4c9ded
Adding app scaffolding for foxy
dylburger Aug 12, 2022
3782012
Adding app scaffolding for foxy
dylburger Aug 12, 2022
aef432b
Adding app scaffolding for foxy
dylburger Aug 12, 2022
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
Prev Previous commit
Next Next commit
GitHub - Add GET request to certain Instant Webhook-Based Sources (Pi…
…pedreamHQ#3938)

* new-card-in-column historical events

* webhook-event updates

* new-commit historical events

* updates per review
  • Loading branch information
michelle0927 authored Aug 9, 2022
commit 4b925ec001e2e8a0efb771aa352bf1c4cf696a86
40 changes: 39 additions & 1 deletion components/github/github.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ export default {
}));
},
},
branch: {
label: "Branch",
description: "Branch to monitor for new commits",
type: "string",
async options({ repoFullname }) {
const branches = await this.getBranches({
repoFullname,
});
return branches.map((branch) => ({
label: branch.name,
value: branch.commit.sha,
}));
},
},
pullNumber: {
type: "integer",
label: "PR Number",
Expand Down Expand Up @@ -136,7 +150,7 @@ export default {
async removeWebhook({
repoFullname, webhookId,
}) {
return this._client().request(`DELETE /webhooks/${repoFullname}/hooks/${webhookId}`, {});
return this._client().request(`DELETE /repos/${repoFullname}/hooks/${webhookId}`, {});
},
async getOrganizations() {
const response = await this._client().request("GET /user/orgs", {});
Expand Down Expand Up @@ -273,5 +287,29 @@ export default {

return response.data;
},
async getCommits({
repoFullname, ...data
}) {
const { data: commits } = await this._client().request(`GET /repos/${repoFullname}/commits`, {
...data,
});
return commits;
},
async getBranches({
repoFullname, ...data
}) {
const { data: branches } = await this._client().request(`GET /repos/${repoFullname}/branches`, {
...data,
});
return branches;
},
async getProjectCards({
columnId, ...data
}) {
const { data: cards } = await this._client().request(`GET /projects/columns/${columnId}/cards`, {
...data,
});
return cards;
},
},
};
6 changes: 6 additions & 0 deletions components/github/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,9 @@ If an issue _doesn't_ yet exist and you need to create one, please [use the issu
You can read about our platform security and privacy [here](https://pipedream.com/docs/privacy-and-security/).

If you'd like to report a suspected vulnerability or security issue, or have any questions about the security of the product, please contact our security team at **[email protected]**.

## Troubleshooting

Note: Event Source [New Card in Column](https://github.com/PipedreamHQ/pipedream/blob/master/components/github/sources/new-card-in-column/new-card-in-column.mjs) only supports legacy (classic) projects.

Please [reach out](https://pipedream.com/support/) to the Pipedream team with any technical issues or questions about the Github integration. We're happy to help!
10 changes: 9 additions & 1 deletion components/github/sources/common/common-webhook.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,17 @@ export default {
getWebhookEvents() {
throw new Error("getWebhookEvents is not implemented");
},
generateMeta() {
throw new Error("generateMeta is not implemented");
},
loadHistoricalEvents() {
return true;
},
},
hooks: {
async deploy() {
await this.loadHistoricalEvents();
},
async activate() {
const response = await this.github.createWebhook({
repoFullname: this.repoFullname,
Expand All @@ -39,7 +48,6 @@ export default {
events: this.getWebhookEvents(),
},
});

this._setWebhookId(response.id);
},
async deactivate() {
Expand Down
37 changes: 26 additions & 11 deletions components/github/sources/new-card-in-column/new-card-in-column.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "github-new-card-in-column",
name: "New Card in Column (Instant)",
description: "Emit new event when a project card is created or moved to a specific column",
version: "0.0.1",
version: "0.1.0",
type: "source",
props: {
...common.props,
Expand Down Expand Up @@ -59,24 +59,39 @@ export default {
ts: Date.parse(card.updated_at),
};
},
async loadHistoricalEvents() {
const cards = await this.github.getProjectCards({
columnId: this.getThisColumnValue(),
per_page: 25,
});
for (const card of cards) {
await this.processCard(card);
}
},
async processCard(card) {
const meta = this.generateMeta(card);
const issue = await this.github.getIssueFromProjectCard({
repoFullname: this.repoFullname,
cardId: card.id,
});
this.$emit({
card,
issue,
}, meta);
},
},
async run(event) {
const card = event.body.project_card;
if (!card) {
console.log("No card in event. Skipping event.");
return;
}

if (!this.isCardInThisColumn(card)) {
console.log(`Card not in ${this.getThisColumnLabel()}. Skipping...`);
return;
}

const meta = this.generateMeta(card);
const issue = await this.github.getIssueFromProjectCard({
repoFullName: this.repoFullname,
cardId: card.id,
});

this.$emit({
card,
issue,
}, meta);
this.processCard(card);
},
};
54 changes: 0 additions & 54 deletions components/github/sources/new-commit-instant/new-commit-instant.js

This file was deleted.

81 changes: 81 additions & 0 deletions components/github/sources/new-commit/new-commit.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import common from "../common/common-webhook.mjs";

export default {
...common,
key: "github-new-commit",
name: "New Commit (Instant)",
description: "Emit new events on new commits to a repo or branch",
version: "0.1.0",
type: "source",
dedupe: "unique",
props: {
...common.props,
branch: {
propDefinition: [
common.props.github,
"branch",
(c) => ({
repoFullname: c.repoFullname,
}),
],
description: "Branch to monitor for new commits. Defaults to master",
optional: true,
withLabel: true,
},
},
methods: {
...common.methods,
getWebhookEvents() {
return [
"push",
];
},
isEventForThisBranch(branch) {
return !this.branch || branch === this.branch.label;
},
generateMeta(data) {
return {
id: data.id,
summary: data.message,
ts: Date.parse(data.timestamp),
};
},
async loadHistoricalEvents() {
const commitInfo = await this.github.getCommits({
repoFullname: this.repoFullname,
sha: this.branch
? this.branch.value
: undefined,
per_page: 25,
});
const commits = commitInfo.map((info) => ({
id: info.commit.url.split("/").pop(),
timestamp: info.commit.committer.date,
...info.commit,
}));
this.processCommits(commits);
},
processCommits(commits) {
for (const commit of commits) {
const meta = this.generateMeta(commit);
this.$emit(commit, meta);
}
},
},
async run(event) {
const { body } = event;

// skip initial response from Github
if (body?.zen) {
console.log(body.zen);
return;
}

const branch = body.ref.split("refs/heads/").pop();
if (!this.isEventForThisBranch(branch)) {
return;
}

this.processCommits(body.commits);
},
};
14 changes: 10 additions & 4 deletions components/github/sources/webhook-event/webhook-event.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import constants from "../common/constants.mjs";

export default {
...common,
key: "github-weebhook-vents",
key: "github-webhook-events",
name: "New Webhook Event (Instant)",
description: "Emit new event for each selected event types",
description: "Emit new event for each selected event type",
type: "source",
version: "0.0.1",
version: "0.0.2",
props: {
...common.props,
events: {
label: "Webhook Events",
description: "The event will be emited",
description: "The event types to be emited",
type: "string[]",
options: constants.REPOSITORY_WEBHOOK_EVENTS,
},
Expand All @@ -30,6 +30,12 @@ export default {
body,
} = event;

// skip initial response from Github
if (body?.zen) {
console.log(body.zen);
return;
}

this.$emit(body, {
id: headers["x-github-delivery"],
summary: `New event ${headers["x-github-hook-installation-target-id"]} of type ${headers["x-github-hook-installation-target-type"]}}`,
Expand Down