diff --git a/components/github/actions/common/constants.mjs b/components/github/actions/common/constants.mjs index b7a28e1828a5f..293413ae9a39c 100644 --- a/components/github/actions/common/constants.mjs +++ b/components/github/actions/common/constants.mjs @@ -6,6 +6,9 @@ const PULL_REQUEST_STATES = [ "PENDING", ]; +const LIMIT = 100; + export default { PULL_REQUEST_STATES, + LIMIT, }; diff --git a/components/github/actions/create-branch/create-branch.mjs b/components/github/actions/create-branch/create-branch.mjs index e3b97390b8e3e..d0d94b6729409 100644 --- a/components/github/actions/create-branch/create-branch.mjs +++ b/components/github/actions/create-branch/create-branch.mjs @@ -5,7 +5,7 @@ export default { key: "github-create-branch", name: "Create Branch", description: "Create a new branch in a Github repo. [See the documentation](https://docs.github.com/en/rest/git/refs?apiVersion=2022-11-28#create-a-reference)", - version: "0.0.13", + version: "0.0.14", type: "action", props: { github, diff --git a/components/github/actions/create-gist/create-gist.mjs b/components/github/actions/create-gist/create-gist.mjs index 8bd85c019a05f..25d2686080932 100644 --- a/components/github/actions/create-gist/create-gist.mjs +++ b/components/github/actions/create-gist/create-gist.mjs @@ -5,7 +5,7 @@ export default { key: "github-create-gist", name: "Create Gist", description: "Allows you to add a new gist with one or more files. [See the documentation](https://docs.github.com/en/rest/gists/gists?apiVersion=2022-11-28#create-a-gist)", - version: "0.0.7", + version: "0.0.8", type: "action", props: { github, diff --git a/components/github/actions/create-issue-comment/create-issue-comment.mjs b/components/github/actions/create-issue-comment/create-issue-comment.mjs index a455eac68b53d..ee0f1d41134c8 100644 --- a/components/github/actions/create-issue-comment/create-issue-comment.mjs +++ b/components/github/actions/create-issue-comment/create-issue-comment.mjs @@ -4,7 +4,7 @@ export default { key: "github-create-issue-comment", name: "Create Issue Comment", description: "Create a new comment in a issue. [See the documentation](https://docs.github.com/en/rest/issues/comments#create-an-issue-comment)", - version: "0.0.18", + version: "0.0.19", type: "action", props: { github, diff --git a/components/github/actions/create-issue/create-issue.mjs b/components/github/actions/create-issue/create-issue.mjs index c146d827b3d22..0dda25f580d70 100644 --- a/components/github/actions/create-issue/create-issue.mjs +++ b/components/github/actions/create-issue/create-issue.mjs @@ -6,7 +6,7 @@ export default { key: "github-create-issue", name: "Create Issue", description: "Create a new issue in a Gihub repo. [See the documentation](https://docs.github.com/en/rest/issues/issues#create-an-issue)", - version: "0.3.0", + version: "0.3.1", type: "action", props: { github, diff --git a/components/github/actions/create-or-update-file-contents/create-or-update-file-contents.mjs b/components/github/actions/create-or-update-file-contents/create-or-update-file-contents.mjs index 61e8a08b5768f..fc06ec04d5617 100644 --- a/components/github/actions/create-or-update-file-contents/create-or-update-file-contents.mjs +++ b/components/github/actions/create-or-update-file-contents/create-or-update-file-contents.mjs @@ -4,7 +4,7 @@ export default { key: "github-create-or-update-file-contents", name: "Create or Update File Contents", description: "Create or update a file in a repository. [See the documentation](https://docs.github.com/en/rest/repos/contents#create-or-update-file-contents)", - version: "0.1.0", + version: "0.1.1", type: "action", props: { github, diff --git a/components/github/actions/create-pull-request/create-pull-request.mjs b/components/github/actions/create-pull-request/create-pull-request.mjs index c6f9881e2fe0b..983b386944113 100644 --- a/components/github/actions/create-pull-request/create-pull-request.mjs +++ b/components/github/actions/create-pull-request/create-pull-request.mjs @@ -5,7 +5,7 @@ export default { key: "github-create-pull-request", name: "Create Pull Request", description: "Creates a new pull request for a specified repository. [See the documentation](https://docs.github.com/en/rest/pulls/pulls#create-a-pull-request)", - version: "0.1.0", + version: "0.1.1", type: "action", props: { github, diff --git a/components/github/actions/create-repository/create-repository.mjs b/components/github/actions/create-repository/create-repository.mjs index 2bad7e7a73f84..b580d9f7e7613 100644 --- a/components/github/actions/create-repository/create-repository.mjs +++ b/components/github/actions/create-repository/create-repository.mjs @@ -4,7 +4,7 @@ export default { key: "github-create-repository", name: "Create Repository", description: "Creates a new repository for the authenticated user. [See the documentation](https://docs.github.com/en/rest/repos/repos#create-a-repository-for-the-authenticated-user)", - version: "0.0.13", + version: "0.0.14", type: "action", props: { github, diff --git a/components/github/actions/create-workflow-dispatch/create-workflow-dispatch.mjs b/components/github/actions/create-workflow-dispatch/create-workflow-dispatch.mjs new file mode 100644 index 0000000000000..b905b02de3506 --- /dev/null +++ b/components/github/actions/create-workflow-dispatch/create-workflow-dispatch.mjs @@ -0,0 +1,57 @@ +import { ConfigurationError } from "@pipedream/platform"; +import github from "../../github.app.mjs"; + +export default { + key: "github-create-workflow-dispatch", + name: "Create Workflow Dispatch", + description: "Creates a new workflow dispatch event. [See the documentation](https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event)", + version: "0.0.1", + type: "action", + props: { + github, + repoFullname: { + propDefinition: [ + github, + "repoFullname", + ], + }, + workflowId: { + propDefinition: [ + github, + "workflowId", + ({ repoFullname }) => ({ + repoFullname, + }), + ], + }, + ref: { + type: "string", + label: "Ref", + description: "The git reference for the workflow. The reference can be a branch or tag name.", + }, + inputs: { + type: "object", + label: "Inputs", + description: "Input keys and values configured in the workflow file. The maximum number of properties is 10. Any default properties configured in the workflow file will be used when inputs are omitted.", + optional: true, + }, + }, + async run({ $ }) { + try { + const response = await this.github.createWorkflowDispatch({ + repoFullname: this.repoFullname, + workflowId: this.workflowId, + data: { + ref: this.ref, + inputs: this.inputs, + }, + }); + + $.export("$summary", "Workflow dispatch successfully created!"); + + return response; + } catch (e) { + throw new ConfigurationError(e?.response?.data?.message); + } + }, +}; diff --git a/components/github/actions/disable-workflow/disable-workflow.mjs b/components/github/actions/disable-workflow/disable-workflow.mjs new file mode 100644 index 0000000000000..ab69a96f76468 --- /dev/null +++ b/components/github/actions/disable-workflow/disable-workflow.mjs @@ -0,0 +1,42 @@ +import { ConfigurationError } from "@pipedream/platform"; +import github from "../../github.app.mjs"; + +export default { + key: "github-disable-workflow", + name: "Disable Workflow", + description: "Disables a workflow and sets the **state** of the workflow to **disabled_manually**. [See the documentation](https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#disable-a-workflow)", + version: "0.0.1", + type: "action", + props: { + github, + repoFullname: { + propDefinition: [ + github, + "repoFullname", + ], + }, + workflowId: { + propDefinition: [ + github, + "workflowId", + ({ repoFullname }) => ({ + repoFullname, + }), + ], + }, + }, + async run({ $ }) { + try { + const response = await this.github.disableWorkflow({ + repoFullname: this.repoFullname, + workflowId: this.workflowId, + }); + + $.export("$summary", `Successfully disabled the workflow with Id: ${this.workflowId}!`); + + return response; + } catch (e) { + throw new ConfigurationError(e?.response?.data?.message); + } + }, +}; diff --git a/components/github/actions/enable-workflow/enable-workflow.mjs b/components/github/actions/enable-workflow/enable-workflow.mjs new file mode 100644 index 0000000000000..72e8152f0427c --- /dev/null +++ b/components/github/actions/enable-workflow/enable-workflow.mjs @@ -0,0 +1,37 @@ +import github from "../../github.app.mjs"; + +export default { + key: "github-enable-workflow", + name: "Enable Workflow", + description: "Enables a workflow and sets the **state** of the workflow to **active**. [See the documentation](https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#enable-a-workflow)", + version: "0.0.1", + type: "action", + props: { + github, + repoFullname: { + propDefinition: [ + github, + "repoFullname", + ], + }, + workflowId: { + propDefinition: [ + github, + "workflowId", + ({ repoFullname }) => ({ + repoFullname, + }), + ], + }, + }, + async run({ $ }) { + const response = await this.github.enableWorkflow({ + repoFullname: this.repoFullname, + workflowId: this.workflowId, + }); + + $.export("$summary", `Successfully enabled the workflow with Id: ${this.workflowId}!`); + + return response; + }, +}; diff --git a/components/github/actions/get-issue-assignees/get-issue-assignees.mjs b/components/github/actions/get-issue-assignees/get-issue-assignees.mjs index ba325f4cd8a61..83c69fb75de68 100644 --- a/components/github/actions/get-issue-assignees/get-issue-assignees.mjs +++ b/components/github/actions/get-issue-assignees/get-issue-assignees.mjs @@ -4,7 +4,7 @@ export default { key: "github-get-issue-assignees", name: "Get Issue Assignees", description: "Get assignees for an issue in a Gihub repo. [See the documentation](https://docs.github.com/en/rest/issues/issues#get-an-issue)", - version: "0.0.18", + version: "0.0.19", type: "action", props: { github, diff --git a/components/github/actions/get-repository-content/get-repository-content.mjs b/components/github/actions/get-repository-content/get-repository-content.mjs index 71306516d49b1..bf7f3ca47e1a8 100644 --- a/components/github/actions/get-repository-content/get-repository-content.mjs +++ b/components/github/actions/get-repository-content/get-repository-content.mjs @@ -4,7 +4,7 @@ export default { key: "github-get-repository-content", name: "Get Repository Content", description: "Get the content of a file or directory in a specific repository. [See the documentation](https://docs.github.com/en/rest/repos/contents#get-repository-content)", - version: "0.1.0", + version: "0.1.1", type: "action", props: { github, diff --git a/components/github/actions/get-repository/get-repository.mjs b/components/github/actions/get-repository/get-repository.mjs index faab708a2c64b..075f481b81dcd 100644 --- a/components/github/actions/get-repository/get-repository.mjs +++ b/components/github/actions/get-repository/get-repository.mjs @@ -4,7 +4,7 @@ export default { key: "github-get-repository", name: "Get Repository Info", description: "Get information for a specific repository. [See the documentation](https://docs.github.com/en/rest/repos/repos#get-a-repository)", - version: "0.0.18", + version: "0.0.19", type: "action", props: { github, diff --git a/components/github/actions/get-reviewers/get-reviewers.mjs b/components/github/actions/get-reviewers/get-reviewers.mjs index 237fa7fe4652b..85f9c8690cf8f 100644 --- a/components/github/actions/get-reviewers/get-reviewers.mjs +++ b/components/github/actions/get-reviewers/get-reviewers.mjs @@ -6,7 +6,7 @@ export default { key: "github-get-reviewers", name: "Get Reviewers", description: "Get reviewers for a PR ([see documentation](https://docs.github.com/en/rest/pulls/reviews#list-reviews-for-a-pull-request)) or Commit SHA ([see documentation](https://docs.github.com/en/rest/commits/commits#list-pull-requests-associated-with-a-commit)).", - version: "0.1.0", + version: "0.1.1", type: "action", props: { github, diff --git a/components/github/actions/get-workflow-run/get-workflow-run.mjs b/components/github/actions/get-workflow-run/get-workflow-run.mjs new file mode 100644 index 0000000000000..a1e261d8ac2f6 --- /dev/null +++ b/components/github/actions/get-workflow-run/get-workflow-run.mjs @@ -0,0 +1,37 @@ +import github from "../../github.app.mjs"; + +export default { + key: "github-get-workflow-run", + name: "Get Workflow Run", + description: "Gets a specific workflow run. [See the documentation](https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#get-a-workflow-run)", + version: "0.0.1", + type: "action", + props: { + github, + repoFullname: { + propDefinition: [ + github, + "repoFullname", + ], + }, + workflowRunId: { + propDefinition: [ + github, + "workflowRunId", + ({ repoFullname }) => ({ + repoFullname, + }), + ], + }, + }, + async run({ $ }) { + const response = await this.github.getWorkflowRun({ + repoFullname: this.repoFullname, + workflowRunId: this.workflowRunId, + }); + + $.export("$summary", `Successfully retrieved the workflow run with Id: ${this.workflowRunId}!.`); + + return response; + }, +}; diff --git a/components/github/actions/list-gists-for-a-user/list-gists-for-a-user.mjs b/components/github/actions/list-gists-for-a-user/list-gists-for-a-user.mjs index 1fb82712793b2..42d6c356f5443 100644 --- a/components/github/actions/list-gists-for-a-user/list-gists-for-a-user.mjs +++ b/components/github/actions/list-gists-for-a-user/list-gists-for-a-user.mjs @@ -5,7 +5,7 @@ export default { key: "github-list-gists-for-a-user", name: "List Gists for a User", description: "Lists public gists for the specified user. [See the documentation](https://docs.github.com/en/rest/gists/gists?apiVersion=2022-11-28#list-gists-for-a-user)", - version: "0.1.0", + version: "0.1.1", type: "action", props: { github: { diff --git a/components/github/actions/list-releases/list-releases.mjs b/components/github/actions/list-releases/list-releases.mjs index b69c42e9c2bba..7e1ff3d36c16e 100644 --- a/components/github/actions/list-releases/list-releases.mjs +++ b/components/github/actions/list-releases/list-releases.mjs @@ -4,7 +4,7 @@ export default { key: "github-list-releases", name: "List Releases", description: "List releases for a repository [See the documentation](https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#list-releases)", - version: "0.0.6", + version: "0.0.7", type: "action", props: { github, diff --git a/components/github/actions/list-workflow-runs/list-workflow-runs.mjs b/components/github/actions/list-workflow-runs/list-workflow-runs.mjs new file mode 100644 index 0000000000000..b4a2711fa8c24 --- /dev/null +++ b/components/github/actions/list-workflow-runs/list-workflow-runs.mjs @@ -0,0 +1,50 @@ +import github from "../../github.app.mjs"; + +export default { + key: "github-list-workflow-runs", + name: "List Workflow Runs", + description: "List workflowRuns for a repository [See the documentation](https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-repository)", + version: "0.0.1", + type: "action", + props: { + github, + repoFullname: { + propDefinition: [ + github, + "repoFullname", + ], + }, + limit: { + type: "integer", + label: "Limit", + description: "The maximum quantity to be returned.", + default: 100, + }, + }, + async run({ $ }) { + let page = 1; + const perPage = 100; + let allWorkflowRuns = []; + let count = 0; + + while (count < this.limit) { + const { workflow_runs: workflowRuns } = await this.github.listWorkflowRuns({ + repoFullname: this.repoFullname, + perPage: perPage, + page: page, + }); + + if (workflowRuns.length === 0) { + break; + } + + allWorkflowRuns = allWorkflowRuns.concat(workflowRuns); + count += workflowRuns.length; + page += 1; + } + + $.export("$summary", `Successfully retrieved ${allWorkflowRuns.length} workflow runs.`); + + return allWorkflowRuns; + }, +}; diff --git a/components/github/actions/search-issues-and-pull-requests/search-issues-and-pull-requests.mjs b/components/github/actions/search-issues-and-pull-requests/search-issues-and-pull-requests.mjs index 8c1a77308d0e8..902ce5be2f379 100644 --- a/components/github/actions/search-issues-and-pull-requests/search-issues-and-pull-requests.mjs +++ b/components/github/actions/search-issues-and-pull-requests/search-issues-and-pull-requests.mjs @@ -4,7 +4,7 @@ export default { key: "github-search-issues-and-pull-requests", name: "Search Issues and Pull Requests", description: "Find issues and pull requests by state and keyword. [See the documentation](https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-requests)", - version: "0.2.0", + version: "0.2.1", type: "action", props: { github, diff --git a/components/github/actions/update-gist/update-gist.mjs b/components/github/actions/update-gist/update-gist.mjs index fd2d8b19ac57b..78fa706de6797 100644 --- a/components/github/actions/update-gist/update-gist.mjs +++ b/components/github/actions/update-gist/update-gist.mjs @@ -6,7 +6,7 @@ export default { key: "github-update-gist", name: "Update Gist", description: "Allows you to update a gist's description and to update, delete, or rename gist files. [See the documentation](https://docs.github.com/en/rest/gists/gists?apiVersion=2022-11-28#update-a-gist)", - version: "0.0.7", + version: "0.0.8", type: "action", props: { github, diff --git a/components/github/actions/update-issue/update-issue.mjs b/components/github/actions/update-issue/update-issue.mjs index 6b8111959b750..82f4e3bcfd76f 100644 --- a/components/github/actions/update-issue/update-issue.mjs +++ b/components/github/actions/update-issue/update-issue.mjs @@ -10,7 +10,7 @@ export default { key: "github-update-issue", name: "Update Issue", description: "Update a new issue in a Gihub repo. [See the documentation](https://docs.github.com/en/rest/issues/issues#update-an-issue)", - version: "0.2.0", + version: "0.2.1", type: "action", props: { github, diff --git a/components/github/actions/update-project-v2-item-status/update-project-v2-item-status.mjs b/components/github/actions/update-project-v2-item-status/update-project-v2-item-status.mjs index 7aff1349e2116..875e2e7d15b57 100644 --- a/components/github/actions/update-project-v2-item-status/update-project-v2-item-status.mjs +++ b/components/github/actions/update-project-v2-item-status/update-project-v2-item-status.mjs @@ -4,7 +4,7 @@ export default { key: "github-update-project-v2-item-status", name: "Update Project (V2) Item Status", description: "Update the status of an item in the selected Project (V2). [See the documentation](https://docs.github.com/en/graphql/reference/mutations#updateprojectv2itemfieldvalue)", - version: "0.0.2", + version: "0.0.3", type: "action", props: { github, diff --git a/components/github/github.app.mjs b/components/github/github.app.mjs index 3c57520b261a3..0df9750200908 100644 --- a/components/github/github.app.mjs +++ b/components/github/github.app.mjs @@ -1,10 +1,11 @@ import { Octokit } from "@octokit/core"; import { paginateRest } from "@octokit/plugin-paginate-rest"; -import queries from "./common/queries.mjs"; import { axios, ConfigurationError, } from "@pipedream/platform"; +import constants from "./actions/common/constants.mjs"; import mutations from "./common/mutations.mjs"; +import queries from "./common/queries.mjs"; const CustomOctokit = Octokit.plugin(paginateRest); @@ -271,6 +272,48 @@ export default { })); }, }, + workflowId: { + type: "string", + label: "Workflow Id", + description: "The Id of the workflow.", + async options({ + repoFullname, page, + }) { + const { workflows: items } = await this.listWorkflows({ + repoFullname, + perPage: constants.LIMIT, + page, + }); + + return items.map(({ + id: value, name: label, + }) => ({ + label, + value, + })); + }, + }, + workflowRunId: { + type: "string", + label: "Workflow Run Id", + description: "The Id of the workflow Run.", + async options({ + repoFullname, page, + }) { + const { workflow_runs: items } = await this.listWorkflowRuns({ + repoFullname, + perPage: constants.LIMIT, + page, + }); + + return items.map(({ + id: value, name: label, + }) => ({ + label, + value, + })); + }, + }, }, methods: { _baseApiUrl() { @@ -685,6 +728,66 @@ export default { return response.data; }, + async listWorkflows({ + repoFullname, + perPage, + page, + }) { + const response = await this._client().request(`GET /repos/${repoFullname}/actions/workflows`, { + per_page: perPage, + page: page, + }); + + return response.data; + }, + async listWorkflowRuns({ + repoFullname, + perPage, + page, + }) { + const response = await this._client().request(`GET /repos/${repoFullname}/actions/runs`, { + per_page: perPage, + page: page, + }); + + return response.data; + }, + async getWorkflowRun({ + repoFullname, workflowRunId, + }) { + const response = await this._client().request(`GET /repos/${repoFullname}/actions/runs/${workflowRunId}`); + + return response.data; + }, + createWorkflowDispatch({ + repoFullname, + workflowId, + ...opts + }) { + return this._makeRequest({ + method: "POST", + path: `/repos/${repoFullname}/actions/workflows/${workflowId}/dispatches`, + ...opts, + }); + }, + disableWorkflow({ + repoFullname, + workflowId, + }) { + return this._makeRequest({ + method: "PUT", + path: `/repos/${repoFullname}/actions/workflows/${workflowId}/disable`, + }); + }, + enableWorkflow({ + repoFullname, + workflowId, + }) { + return this._makeRequest({ + method: "PUT", + path: `/repos/${repoFullname}/actions/workflows/${workflowId}/enable`, + }); + }, async getUserRepoPermissions({ repoFullname, username, }) { diff --git a/components/github/package.json b/components/github/package.json index 5329710a21a41..4efd95ae9877a 100644 --- a/components/github/package.json +++ b/components/github/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/github", - "version": "1.5.0", + "version": "1.6.0", "description": "Pipedream Github Components", "main": "github.app.mjs", "keywords": [ @@ -13,9 +13,8 @@ "@octokit/core": "^4.2.4", "@octokit/plugin-paginate-rest": "^2.17.0", "@octokit/webhooks-definitions": "^3.29.0", - "@pipedream/platform": "^1.5.1" + "@pipedream/platform": "^3.0.3" }, - "gitHead": "e12480b94cc03bed4808ebc6b13e7fdb3a1ba535", "publishConfig": { "access": "public" } diff --git a/components/github/sources/new-branch/new-branch.mjs b/components/github/sources/new-branch/new-branch.mjs index 710fe1a04655d..1d9209849e455 100644 --- a/components/github/sources/new-branch/new-branch.mjs +++ b/components/github/sources/new-branch/new-branch.mjs @@ -8,7 +8,7 @@ export default { key: "github-new-branch", name: "New Branch Created", description: "Emit new event when a branch is created.", - version: "1.0.7", + version: "1.0.8", type: "source", dedupe: "unique", methods: { diff --git a/components/github/sources/new-card-in-column/new-card-in-column.mjs b/components/github/sources/new-card-in-column/new-card-in-column.mjs index 7ce3b01a02093..b65b4078359e8 100644 --- a/components/github/sources/new-card-in-column/new-card-in-column.mjs +++ b/components/github/sources/new-card-in-column/new-card-in-column.mjs @@ -7,7 +7,7 @@ export default { key: "github-new-card-in-column", name: "New Card in Column (Classic Projects)", description: "Emit new event when a (classic) project card is created or moved to a specific column. For Projects V2 use `New Issue with Status` trigger. [More information here](https://docs.github.com/en/issues/organizing-your-work-with-project-boards/tracking-work-with-project-boards/adding-issues-and-pull-requests-to-a-project-board)", - version: "1.0.6", + version: "1.0.7", type: "source", props: { ...common.props, diff --git a/components/github/sources/new-collaborator/new-collaborator.mjs b/components/github/sources/new-collaborator/new-collaborator.mjs index f422ef844af92..83976ef7f319c 100644 --- a/components/github/sources/new-collaborator/new-collaborator.mjs +++ b/components/github/sources/new-collaborator/new-collaborator.mjs @@ -8,7 +8,7 @@ export default { key: "github-new-collaborator", name: "New Collaborator", description: "Emit new event when a collaborator is added", - version: "1.0.7", + version: "1.0.8", type: "source", dedupe: "unique", methods: { diff --git a/components/github/sources/new-commit-comment/new-commit-comment.mjs b/components/github/sources/new-commit-comment/new-commit-comment.mjs index 1af43146322f2..d9870f21f2cc2 100644 --- a/components/github/sources/new-commit-comment/new-commit-comment.mjs +++ b/components/github/sources/new-commit-comment/new-commit-comment.mjs @@ -8,7 +8,7 @@ export default { key: "github-new-commit-comment", name: "New Commit Comment", description: "Emit new event when a commit comment is created", - version: "1.0.7", + version: "1.0.8", type: "source", dedupe: "unique", props: { diff --git a/components/github/sources/new-commit/new-commit.mjs b/components/github/sources/new-commit/new-commit.mjs index 4eb7f57a47b79..1bf7d80927b2e 100644 --- a/components/github/sources/new-commit/new-commit.mjs +++ b/components/github/sources/new-commit/new-commit.mjs @@ -8,7 +8,7 @@ export default { key: "github-new-commit", name: "New Commit", description: "Emit new event when commits are pushed to a branch", - version: "1.0.8", + version: "1.0.9", type: "source", dedupe: "unique", props: { diff --git a/components/github/sources/new-discussion/new-discussion.mjs b/components/github/sources/new-discussion/new-discussion.mjs index b0ad87cc0efbb..56ca099685a47 100644 --- a/components/github/sources/new-discussion/new-discussion.mjs +++ b/components/github/sources/new-discussion/new-discussion.mjs @@ -8,7 +8,7 @@ export default { key: "github-new-discussion", name: "New Discussion", description: "Emit new event when a discussion is created", - version: "1.0.7", + version: "1.0.8", type: "source", dedupe: "unique", methods: { diff --git a/components/github/sources/new-fork/new-fork.mjs b/components/github/sources/new-fork/new-fork.mjs index 4f96eba6ab4ee..4b3a9716b9976 100644 --- a/components/github/sources/new-fork/new-fork.mjs +++ b/components/github/sources/new-fork/new-fork.mjs @@ -8,7 +8,7 @@ export default { key: "github-new-fork", name: "New Fork", description: "Emit new event when a repository is forked", - version: "1.0.7", + version: "1.0.8", type: "source", dedupe: "unique", methods: { diff --git a/components/github/sources/new-gist/new-gist.mjs b/components/github/sources/new-gist/new-gist.mjs index 197c35625ed2c..760123c27390f 100644 --- a/components/github/sources/new-gist/new-gist.mjs +++ b/components/github/sources/new-gist/new-gist.mjs @@ -4,8 +4,8 @@ export default { ...common, key: "github-new-gist", name: "New Gist", - description: "Emit new events when new gists are created by the authenticated user. [See the documentatoion](https://docs.github.com/en/rest/gists/gists?apiVersion=2022-11-28#list-gists-for-the-authenticated-user)", - version: "0.2.1", + description: "Emit new events when new gists are created by the authenticated user. [See the documentatoion](https://docs.github.com/en/rest/gists/gists?apiVersion=20.2.21-28#list-gists-for-the-authenticated-user)", + version: "0.2.2", type: "source", dedupe: "unique", methods: { diff --git a/components/github/sources/new-issue-with-status/new-issue-with-status.mjs b/components/github/sources/new-issue-with-status/new-issue-with-status.mjs index f8c2a7adf3979..8bdb0736445c0 100644 --- a/components/github/sources/new-issue-with-status/new-issue-with-status.mjs +++ b/components/github/sources/new-issue-with-status/new-issue-with-status.mjs @@ -8,7 +8,7 @@ export default { key: "github-new-issue-with-status", name: "Project Item Status Changed", description: "Emit new event when a project item is tagged with a specific status. Currently supports Organization Projects only. [More information here](https://docs.github.com/en/issues/planning-and-tracking-with-projects/managing-items-in-your-project/adding-items-to-your-project)", - version: "0.1.4", + version: "0.1.5", type: "source", dedupe: "unique", props: { diff --git a/components/github/sources/new-label/new-label.mjs b/components/github/sources/new-label/new-label.mjs index ab8142386b786..95516f5d30347 100644 --- a/components/github/sources/new-label/new-label.mjs +++ b/components/github/sources/new-label/new-label.mjs @@ -8,7 +8,7 @@ export default { key: "github-new-label", name: "New Label", description: "Emit new event when a new label is created", - version: "1.0.7", + version: "1.0.8", type: "source", dedupe: "unique", methods: { diff --git a/components/github/sources/new-mention/new-mention.mjs b/components/github/sources/new-mention/new-mention.mjs index 98c5457c54c6f..a77325db8a16d 100644 --- a/components/github/sources/new-mention/new-mention.mjs +++ b/components/github/sources/new-mention/new-mention.mjs @@ -4,8 +4,8 @@ export default { ...common, key: "github-new-mention", name: "New Mention", - description: "Emit new event when you are @mentioned in a new commit, comment, issue or pull request. [See the documentation](https://docs.github.com/en/rest/activity/notifications?apiVersion=2022-11-28#list-notifications-for-the-authenticated-user)", - version: "0.2.1", + description: "Emit new event when you are @mentioned in a new commit, comment, issue or pull request. [See the documentation](https://docs.github.com/en/rest/activity/notifications?apiVersion=20.2.21-28#list-notifications-for-the-authenticated-user)", + version: "0.2.2", type: "source", dedupe: "unique", methods: { diff --git a/components/github/sources/new-notification/new-notification.mjs b/components/github/sources/new-notification/new-notification.mjs index 1411bea450e59..c904e32040cdf 100644 --- a/components/github/sources/new-notification/new-notification.mjs +++ b/components/github/sources/new-notification/new-notification.mjs @@ -4,8 +4,8 @@ export default { ...common, key: "github-new-notification", name: "New Notification", - description: "Emit new event when the authenticated user receives a new notification. [See the documentation](https://docs.github.com/en/rest/activity/notifications?apiVersion=2022-11-28#list-notifications-for-the-authenticated-user)", - version: "0.2.1", + description: "Emit new event when the authenticated user receives a new notification. [See the documentation](https://docs.github.com/en/rest/activity/notifications?apiVersion=20.2.21-28#list-notifications-for-the-authenticated-user)", + version: "0.2.2", type: "source", dedupe: "unique", methods: { diff --git a/components/github/sources/new-or-updated-issue/new-or-updated-issue.mjs b/components/github/sources/new-or-updated-issue/new-or-updated-issue.mjs index f9c78a910e5ad..8a40d57df19f9 100644 --- a/components/github/sources/new-or-updated-issue/new-or-updated-issue.mjs +++ b/components/github/sources/new-or-updated-issue/new-or-updated-issue.mjs @@ -9,7 +9,7 @@ export default { key: "github-new-or-updated-issue", name: "New or Updated Issue", description: "Emit new events when an issue is created or updated", - version: "1.1.4", + version: "1.1.5", type: "source", dedupe: "unique", methods: { diff --git a/components/github/sources/new-or-updated-milestone/new-or-updated-milestone.mjs b/components/github/sources/new-or-updated-milestone/new-or-updated-milestone.mjs index f21a9c8070776..2675f136a67fb 100644 --- a/components/github/sources/new-or-updated-milestone/new-or-updated-milestone.mjs +++ b/components/github/sources/new-or-updated-milestone/new-or-updated-milestone.mjs @@ -9,7 +9,7 @@ export default { key: "github-new-or-updated-milestone", name: "New or Updated Milestone", description: "Emit new event when a milestone is created or updated", - version: "1.1.4", + version: "1.1.5", type: "source", dedupe: "unique", methods: { diff --git a/components/github/sources/new-or-updated-pull-request/new-or-updated-pull-request.mjs b/components/github/sources/new-or-updated-pull-request/new-or-updated-pull-request.mjs index af692b0bba51c..15032110c24e1 100644 --- a/components/github/sources/new-or-updated-pull-request/new-or-updated-pull-request.mjs +++ b/components/github/sources/new-or-updated-pull-request/new-or-updated-pull-request.mjs @@ -9,7 +9,7 @@ export default { key: "github-new-or-updated-pull-request", name: "New or Updated Pull Request", description: "Emit new event when a pull request is opened or updated", - version: "1.2.4", + version: "1.2.5", type: "source", dedupe: "unique", methods: { diff --git a/components/github/sources/new-organization/new-organization.mjs b/components/github/sources/new-organization/new-organization.mjs index c10cad683bf13..4906515b39722 100644 --- a/components/github/sources/new-organization/new-organization.mjs +++ b/components/github/sources/new-organization/new-organization.mjs @@ -4,8 +4,8 @@ export default { ...common, key: "github-new-organization", name: "New Organization", - description: "Emit new event when the authenticated user is added to a new organization. [See the documentation](https://docs.github.com/en/rest/orgs/orgs?apiVersion=2022-11-28#list-organizations-for-the-authenticated-user)", - version: "0.2.1", + description: "Emit new event when the authenticated user is added to a new organization. [See the documentation](https://docs.github.com/en/rest/orgs/orgs?apiVersion=20.2.21-28#list-organizations-for-the-authenticated-user)", + version: "0.2.2", type: "source", dedupe: "unique", methods: { diff --git a/components/github/sources/new-release/new-release.mjs b/components/github/sources/new-release/new-release.mjs index 7d8696ebc10eb..7da8d32396ee9 100644 --- a/components/github/sources/new-release/new-release.mjs +++ b/components/github/sources/new-release/new-release.mjs @@ -8,7 +8,7 @@ export default { key: "github-new-release", name: "New release", description: "Emit new event when a new release is created", - version: "1.0.7", + version: "1.0.8", type: "source", dedupe: "unique", methods: { diff --git a/components/github/sources/new-repository/new-repository.mjs b/components/github/sources/new-repository/new-repository.mjs index 00a86fe9cd66e..0f21c0bf6b94c 100644 --- a/components/github/sources/new-repository/new-repository.mjs +++ b/components/github/sources/new-repository/new-repository.mjs @@ -4,8 +4,8 @@ export default { ...common, key: "github-new-repository", name: "New Repository", - description: "Emit new event when a new repository is created or when the authenticated user receives access. [See the documentation](https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#list-repositories-for-the-authenticated-user)", - version: "0.2.1", + description: "Emit new event when a new repository is created or when the authenticated user receives access. [See the documentation](https://docs.github.com/en/rest/repos/repos?apiVersion=20.2.21-28#list-repositories-for-the-authenticated-user)", + version: "0.2.2", type: "source", dedupe: "unique", methods: { diff --git a/components/github/sources/new-review-request/new-review-request.mjs b/components/github/sources/new-review-request/new-review-request.mjs index a4ae8cbf4b331..fddac84807a36 100644 --- a/components/github/sources/new-review-request/new-review-request.mjs +++ b/components/github/sources/new-review-request/new-review-request.mjs @@ -4,8 +4,8 @@ export default { ...common, key: "github-new-review-request", name: "New Review Request", - description: "Emit new event for new review request notifications. [See the documentation](https://docs.github.com/en/rest/activity/notifications?apiVersion=2022-11-28#list-notifications-for-the-authenticated-user)", - version: "0.2.1", + description: "Emit new event for new review request notifications. [See the documentation](https://docs.github.com/en/rest/activity/notifications?apiVersion=20.2.21-28#list-notifications-for-the-authenticated-user)", + version: "0.2.2", type: "source", dedupe: "unique", methods: { diff --git a/components/github/sources/new-security-alert/new-security-alert.mjs b/components/github/sources/new-security-alert/new-security-alert.mjs index c56265ac1d30d..caf1ea1fbbfcf 100644 --- a/components/github/sources/new-security-alert/new-security-alert.mjs +++ b/components/github/sources/new-security-alert/new-security-alert.mjs @@ -4,8 +4,8 @@ export default { ...common, key: "github-new-security-alert", name: "New Security Alert", - description: "Emit new event for security alert notifications. [See the documentation](https://docs.github.com/en/rest/activity/notifications?apiVersion=2022-11-28#list-notifications-for-the-authenticated-user)", - version: "0.2.1", + description: "Emit new event for security alert notifications. [See the documentation](https://docs.github.com/en/rest/activity/notifications?apiVersion=20.2.21-28#list-notifications-for-the-authenticated-user)", + version: "0.2.2", type: "source", dedupe: "unique", methods: { diff --git a/components/github/sources/new-star-by-user/new-star-by-user.mjs b/components/github/sources/new-star-by-user/new-star-by-user.mjs index 775bb75b13c91..2de9a84cca472 100644 --- a/components/github/sources/new-star-by-user/new-star-by-user.mjs +++ b/components/github/sources/new-star-by-user/new-star-by-user.mjs @@ -5,7 +5,7 @@ export default { key: "github-new-star-by-user", name: "New Star By User", description: "Emit new events when the specified user stars a repository. [See the documentation](https://docs.github.com/en/rest/activity/starring?apiVersion=2022-11-28#list-repositories-starred-by-a-user)", - version: "0.0.6", + version: "0.0.7", type: "source", dedupe: "unique", props: { diff --git a/components/github/sources/new-star/new-star.mjs b/components/github/sources/new-star/new-star.mjs index 636ec54a42b14..a963aa1b9489c 100644 --- a/components/github/sources/new-star/new-star.mjs +++ b/components/github/sources/new-star/new-star.mjs @@ -8,7 +8,7 @@ export default { key: "github-new-star", name: "New Stars", description: "Emit new event when a repository is starred", - version: "1.0.7", + version: "1.0.8", type: "source", dedupe: "unique", methods: { diff --git a/components/github/sources/new-team/new-team.mjs b/components/github/sources/new-team/new-team.mjs index 82b153e2f308e..aa1e544416747 100644 --- a/components/github/sources/new-team/new-team.mjs +++ b/components/github/sources/new-team/new-team.mjs @@ -4,8 +4,8 @@ export default { ...common, key: "github-new-team", name: "New Team", - description: "Emit new event when the authenticated user is added to a new team. [See the documentation](https://docs.github.com/en/rest/teams/teams?apiVersion=2022-11-28#list-teams-for-the-authenticated-user)", - version: "0.2.1", + description: "Emit new event when the authenticated user is added to a new team. [See the documentation](https://docs.github.com/en/rest/teams/teams?apiVersion=20.2.21-28#list-teams-for-the-authenticated-user)", + version: "0.2.2", type: "source", dedupe: "unique", methods: { diff --git a/components/github/sources/new-workflow-job-completed/new-workflow-job-completed.mjs b/components/github/sources/new-workflow-job-completed/new-workflow-job-completed.mjs new file mode 100644 index 0000000000000..6cb69e212a4ed --- /dev/null +++ b/components/github/sources/new-workflow-job-completed/new-workflow-job-completed.mjs @@ -0,0 +1,47 @@ +import common from "../common/common-webhook.mjs"; +import { getRelevantHeaders } from "../common/utils.mjs"; + +export default { + ...common, + key: "github-new-workflow-job-completed", + name: "New Workflow Job Completed (Instant)", + description: "Emit new event when a job in a workflow is completed, regardless of whether the job was successful or unsuccessful.", + type: "source", + version: "0.0.1", + dedupe: "unique", + methods: { + ...common.methods, + getWebhookEvents() { + return [ + "workflow_job", + ]; + }, + }, + async run(event) { + const { + headers, + body, + } = event; + + // skip initial response from Github or not completed + if (body?.zen || body?.action != "completed") { + return; + } + + this.$emit({ + ...getRelevantHeaders(headers), + ...body, + }, { + id: headers["x-github-delivery"], + summary: "New workflow job completed.", + ts: new Date(), + }); + }, + async activate() { + const isAdmin = await this.checkAdminPermission(); + if (!isAdmin) { + throw new Error("Webhooks are only supported on repos where you have admin access."); + } + await this.createWebhook(); + }, +}; diff --git a/components/github/sources/new-workflow-run-completed/new-workflow-run-completed.mjs b/components/github/sources/new-workflow-run-completed/new-workflow-run-completed.mjs new file mode 100644 index 0000000000000..1adf00fa69144 --- /dev/null +++ b/components/github/sources/new-workflow-run-completed/new-workflow-run-completed.mjs @@ -0,0 +1,47 @@ +import common from "../common/common-webhook.mjs"; +import { getRelevantHeaders } from "../common/utils.mjs"; + +export default { + ...common, + key: "github-new-workflow-run-completed", + name: "New Workflow Run Completed (Instant)", + description: "Emit new event when a Github Actions workflow run completes", + type: "source", + version: "0.0.1", + dedupe: "unique", + methods: { + ...common.methods, + getWebhookEvents() { + return [ + "workflow_run", + ]; + }, + }, + async run(event) { + const { + headers, + body, + } = event; + + // skip initial response from Github or not completed + if (body?.zen || body?.action != "completed") { + return; + } + + this.$emit({ + ...getRelevantHeaders(headers), + ...body, + }, { + id: headers["x-github-delivery"], + summary: "New workflow run completed.", + ts: new Date(), + }); + }, + async activate() { + const isAdmin = await this.checkAdminPermission(); + if (!isAdmin) { + throw new Error("Webhooks are only supported on repos where you have admin access."); + } + await this.createWebhook(); + }, +}; diff --git a/components/github/sources/webhook-events/webhook-events.mjs b/components/github/sources/webhook-events/webhook-events.mjs index 9dd49e0f51160..84b61f83404e0 100644 --- a/components/github/sources/webhook-events/webhook-events.mjs +++ b/components/github/sources/webhook-events/webhook-events.mjs @@ -8,7 +8,7 @@ export default { name: "New Webhook Event (Instant)", description: "Emit new event for each selected event type", type: "source", - version: "1.0.7", + version: "1.0.8", dedupe: "unique", props: { docsInfo: { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bfd11476845c8..45e8a71bd5212 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3966,8 +3966,8 @@ importers: specifier: ^3.29.0 version: 3.67.3 '@pipedream/platform': - specifier: ^1.5.1 - version: 1.6.6 + specifier: ^3.0.3 + version: 3.0.3 components/gitlab: dependencies: