Skip to content

Commit

Permalink
Merge branch 'master' into issue-14132
Browse files Browse the repository at this point in the history
  • Loading branch information
luancazarine authored Oct 1, 2024
2 parents b3aa956 + c6bcdf0 commit b5c8861
Show file tree
Hide file tree
Showing 114 changed files with 3,535 additions and 369 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
done
echo "files=${files}" >> $GITHUB_ENV
- uses: rojopolis/spellcheck-github-actions@0.40.0
- uses: rojopolis/spellcheck-github-actions@0.42.0
name: Spellcheck
if: ${{ env.files }}
with:
Expand Down
2 changes: 1 addition & 1 deletion components/box/actions/download-file/download-file.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "Download File",
description: "Downloads a file from Box to your workflow's `/tmp` directory. [See the documentation](https://developer.box.com/reference/get-files-id-content/)",
key: "box-download-file",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
app,
Expand Down
48 changes: 48 additions & 0 deletions components/box/actions/get-comments/get-comments.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import app from "../../box.app.mjs";
import utils from "../../common/utils.mjs";

export default {
name: "Get Comments",
description: "Fetches comments for a file. [See the documentation](https://developer.box.com/reference/get-files-id-comments/).",
key: "box-get-comments",
version: "0.0.1",
type: "action",
props: {
app,
folderId: {
propDefinition: [
app,
"parentId",
],
label: "Parent Folder",
description: "Use this option to select your File ID from a dropdown list.",
},
fileId: {
propDefinition: [
app,
"fileId",
(c) => ({
folderId: c.folderId,
}),
],
label: "File ID",
description: "The file ID to get comments from. Use a custom expression to reference a file from your workflow or select it from the dropdown list.",
},
},
async run({ $ }) {
const results = [];
const resourcesStream = utils.getResourcesStream({
resourceFn: this.app.getComments,
resourceFnArgs: {
$,
fileId: this.fileId,
},
});
for await (const resource of resourcesStream) {
results.push(resource);
}
// eslint-disable-next-line multiline-ternary
$.export("$summary", results.length ? `Successfully fetched ${results.length} comment${results.length === 1 ? "" : "s"}.` : "No comments found.");
return results;
},
};
2 changes: 1 addition & 1 deletion components/box/actions/search-content/search-content.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
name: "Search Content",
description: "Searches for files, folders, web links, and shared files across the users content or across the entire enterprise. [See the documentation](https://developer.box.com/reference/get-search/).",
key: "box-search-content",
version: "0.0.3",
version: "0.0.4",
type: "action",
props: {
app,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "Upload File Version",
description: "Update a file's content. [See the documentation](https://developer.box.com/reference/post-files-id-content/).",
key: "box-upload-file-version",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
app,
Expand Down
2 changes: 1 addition & 1 deletion components/box/actions/upload-file/upload-file.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "Upload a File",
description: "Uploads a small file to Box. [See the documentation](https://developer.box.com/reference/post-files-content/).",
key: "box-upload-file",
version: "0.0.3",
version: "0.0.4",
type: "action",
props: {
app,
Expand Down
9 changes: 9 additions & 0 deletions components/box/box.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -310,5 +310,14 @@ export default {
...args,
});
},
async getComments({
fileId, ...args
} = {}) {
return this._makeRequest({
method: "GET",
path: `/files/${fileId}/comments`,
...args,
});
},
},
};
2 changes: 1 addition & 1 deletion components/box/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/box",
"version": "0.2.0",
"version": "0.3.0",
"description": "Pipedream Box Components",
"main": "box.app.mjs",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion components/box/sources/new-event/new-event.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "box-new-event",
name: "New Event",
description: "Emit new event when an event with subscribed event source triggered on a target. [See the documentation](https://developer.box.com/reference/post-webhooks)",
version: "0.0.3",
version: "0.0.4",
type: "source",
dedupe: "unique",
...common,
Expand Down
2 changes: 1 addition & 1 deletion components/box/sources/new-file/new-file.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "box-new-file",
name: "New File Event",
description: "Emit new event when a new file uploaded on a target. [See the documentation](https://developer.box.com/reference/post-webhooks)",
version: "0.0.3",
version: "0.0.4",
type: "source",
dedupe: "unique",
...common,
Expand Down
2 changes: 1 addition & 1 deletion components/box/sources/new-folder/new-folder.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "box-new-folder",
name: "New Folder Event",
description: "Emit new event when a new folder created on a target. [See the documentation](https://developer.box.com/reference/post-webhooks)",
version: "0.0.3",
version: "0.0.4",
type: "source",
dedupe: "unique",
...common,
Expand Down
2 changes: 1 addition & 1 deletion components/easy_peasy_ai/easy_peasy_ai.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
60 changes: 60 additions & 0 deletions components/github/actions/common/asyncProps.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
export default {
assignees: {
label: "Assignees",
description: "One or more Users to assign to this issue",
type: "string[]",
optional: true,
options: async () => {
const collaborators = await this.github.getRepositoryCollaborators({
repoFullname: this.repoFullname,
});

return collaborators.map(({ login }) => login);
},
},
labels: {
label: "Labels",
description: "The label(s) to add to the issue",
type: "string[]",
optional: true,
options: async () => {
const labels = await this.github.getRepositoryLabels({
repoFullname: this.repoFullname,
});

return labels.map(({ name }) => name);
},
},
milestoneNumber: {
type: "integer",
label: "Milestone Number",
description: "The number of a milestone to associate the issue with",
optional: true,
options: async () => {
const items = await this.github.getRepositoryMilestones({
repoFullname: this.repoFullname,
});

return items.map((item) => ({
label: item.title,
value: +item.number,
}));
},
},
pullNumber: {
type: "integer",
label: "Pull Request Number",
description: "The pull request to get reviewers for",
options: async ({ page }) => {
const prs = await this.github.getRepositoryPullRequests({
page: page + 1,
repoFullname: this.repoFullname,
});

return prs.map((pr) => ({
label: pr.title,
value: +pr.number,
}));
},
},
};
8 changes: 4 additions & 4 deletions components/github/actions/create-branch/create-branch.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import github from "../../github.app.mjs";
export default {
key: "github-create-branch",
name: "Create Branch",
description: "Create a new branch in a Github repo. [See docs here](https://docs.github.com/en/rest/git/refs?apiVersion=2022-11-28#create-a-reference)",
version: "0.0.12",
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",
type: "action",
props: {
github,
Expand All @@ -17,12 +17,12 @@ export default {
},
branchName: {
label: "Branch Name",
description: "The name of the new branch that will be crated",
description: "The name of the new branch that will be created",
type: "string",
},
branchSha: {
label: "Source Branch",
description: "The source branch that will be used to create the new branch",
description: "The source branch that will be used to create the new branch. Defaults to the repository's default branch (usually `main` or `master`)",
propDefinition: [
github,
"branch",
Expand Down
4 changes: 2 additions & 2 deletions components/github/actions/create-gist/create-gist.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import utils from "../../actions/common/utils.mjs";
export default {
key: "github-create-gist",
name: "Create Gist",
description: "Allows you to add a new gist with one or more files. [See docs here](https://docs.github.com/en/rest/gists/gists?apiVersion=2022-11-28#create-a-gist)",
version: "0.0.6",
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",
type: "action",
props: {
github,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import github from "../../github.app.mjs";
export default {
key: "github-create-issue-comment",
name: "Create Issue Comment",
description: "Create a new comment in a issue. [See docs here](https://docs.github.com/en/rest/issues/comments#create-an-issue-comment)",
version: "0.0.17",
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",
type: "action",
props: {
github,
Expand Down
69 changes: 33 additions & 36 deletions components/github/actions/create-issue/create-issue.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { checkPushPermission } from "../../common/utils.mjs";
import github from "../../github.app.mjs";
import asyncProps from "../common/asyncProps.mjs";

export default {
key: "github-create-issue",
name: "Create Issue",
description: "Create a new issue in a Gihub repo. [See docs here](https://docs.github.com/en/rest/issues/issues#create-an-issue)",
version: "0.2.16",
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",
type: "action",
props: {
github,
Expand All @@ -13,6 +15,7 @@ export default {
github,
"repoFullname",
],
reloadProps: true,
},
title: {
label: "Title",
Expand All @@ -21,47 +24,41 @@ export default {
},
body: {
label: "Body",
description: "The contents of the issue",
description: "The text body of the issue",
type: "string",
optional: true,
},
labels: {
label: "Labels",
description: "Labels to associate with this issue. NOTE: Only users with push access can set labels for new issues",
optional: true,
propDefinition: [
github,
"labels",
(c) => ({
repoFullname: c.repoFullname,
}),
],
},
assignees: {
label: "Assignees",
description: "Logins for Users to assign to this issue. NOTE: Only users with push access can set assignees for new issues",
optional: true,
propDefinition: [
github,
"collaborators",
(c) => ({
repoFullname: c.repoFullname,
}),
],
},
},
methods: {
checkPushPermission,
},
async additionalProps() {
const canPush = await this.checkPushPermission();
return canPush
? {
assignees: asyncProps.assignees,
labels: asyncProps.labels,
milestoneNumber: asyncProps.milestoneNumber,
}
: {
infoBox: {
type: "alert",
alertType: "info",
content: "Labels, assignees and milestones can only be set by users with push access to the repository.",
},
};
},
async run({ $ }) {
const response = await this.github.createIssue({
repoFullname: this.repoFullname,
data: {
title: this.title,
body: this.body,
labels: this.labels,
assignees: this.assignees,
},
const { // eslint-disable-next-line no-unused-vars
github, repoFullname, infoBox, ...data
} = this;

const response = await github.createIssue({
repoFullname,
data,
});

$.export("$summary", "Successfully created issue.");
$.export("$summary", `Successfully created issue (ID: ${response.id})`);

return response;
},
Expand Down
Loading

0 comments on commit b5c8861

Please sign in to comment.