Skip to content

Commit 225921b

Browse files
committed
List Gists and Update Gist updates
1 parent 763bdeb commit 225921b

File tree

2 files changed

+32
-10
lines changed

2 files changed

+32
-10
lines changed

components/github/actions/list-gists-for-a-user/list-gists-for-a-user.mjs

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,51 @@
1+
import { ConfigurationError } from "@pipedream/platform";
12
import github from "../../github.app.mjs";
23

34
export default {
45
key: "github-list-gists-for-a-user",
56
name: "List Gists for a User",
67
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)",
7-
version: "0.0.6",
8+
version: "0.1.{{ts}}",
89
type: "action",
910
props: {
10-
github,
11-
username: {
12-
label: "Username",
13-
description: "The username of the user whose gists you want to list",
14-
type: "string",
11+
github: {
12+
...github,
13+
reloadProps: true,
1514
},
1615
since: {
17-
label: "Since",
18-
description: "Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.",
16+
label: "Filter by Timestamp",
17+
description: "Only show notifications updated since the given time. This should be a timestamp in ISO 8601 format, e.g. `2018-05-16T09:30:10Z` or [another standard date/time format](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format).",
1918
type: "string",
2019
optional: true,
2120
},
2221
},
22+
async additionalProps() {
23+
const { login } = await this.github.getAuthenticatedUser();
24+
return {
25+
username: {
26+
label: "Username",
27+
description: "The username of the user whose gists you want to list",
28+
type: "string",
29+
default: login,
30+
},
31+
};
32+
},
2333
async run({ $ }) {
2434
const PER_PAGE = 100;
2535
const MAX_PAGES = 50;
2636
let page = 1;
2737
const data = [];
2838

39+
const date = new Date(this.since);
40+
if (isNaN(date.getTime())) {
41+
throw new ConfigurationError("Invalid date string provided");
42+
}
43+
44+
const since = date.toISOString();
45+
2946
while (true) {
3047
const res = await this.github.listGistsFromUser(this.username, {
31-
since: this.since,
48+
since,
3249
per_page: PER_PAGE,
3350
page,
3451
});

components/github/actions/update-gist/update-gist.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@ import { ConfigurationError } from "@pipedream/platform";
55
export default {
66
key: "github-update-gist",
77
name: "Update Gist",
8-
description: "Allows you to update a gist's description and to update, delete, or rename gist files. Files from the previous version of the gist that aren't explicitly changed during an edit are unchanged. At least one of description or files is required. [See the documentation](https://docs.github.com/en/rest/gists/gists?apiVersion=2022-11-28#update-a-gist)",
8+
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)",
99
version: "0.0.6",
1010
type: "action",
1111
props: {
1212
github,
13+
infoAlert: {
14+
type: "alert",
15+
alertType: "info",
16+
content: "Files from the previous version of the gist that aren't explicitly changed during an edit are unchanged. At least one of description or files is required.",
17+
},
1318
gistId: {
1419
propDefinition: [
1520
github,

0 commit comments

Comments
 (0)