-
Notifications
You must be signed in to change notification settings - Fork 5.5k
14859 components GitHub #14916
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
Merged
Merged
14859 components GitHub #14916
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
66a361b
[Components] github #14859
luancazarine 5582cfb
Merge branch 'master' into 14859-components-github
luancazarine 12c2b5a
bump versions
luancazarine 1e8ef46
set workflowRunId as required
luancazarine b791c1c
some adjusts
luancazarine 9481341
fix package.json
luancazarine 563f462
pnpm update
luancazarine 5885f16
fix lint
luancazarine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,9 @@ const PULL_REQUEST_STATES = [ | |
"PENDING", | ||
]; | ||
|
||
const LIMIT = 100; | ||
|
||
export default { | ||
PULL_REQUEST_STATES, | ||
LIMIT, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
components/github/actions/create-workflow-dispatch/create-workflow-dispatch.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
}, | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
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); | ||
} | ||
}, | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; |
42 changes: 42 additions & 0 deletions
42
components/github/actions/disable-workflow/disable-workflow.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
}, | ||
}; |
37 changes: 37 additions & 0 deletions
37
components/github/actions/enable-workflow/enable-workflow.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
}); | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
$.export("$summary", `Successfully enabled the workflow with Id: ${this.workflowId}!`); | ||
|
||
return response; | ||
}, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
components/github/actions/get-workflow-run/get-workflow-run.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}, | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
components/github/actions/list-workflow-runs/list-workflow-runs.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.