Skip to content

Commit adb1072

Browse files
committed
PR comments
1 parent 978f042 commit adb1072

4 files changed

Lines changed: 43 additions & 191 deletions

File tree

docs/guide/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,13 @@ backups:
144144
# Backup all GitHub Gist accessible to the user associated with the provided credentials
145145
- kind: github/gist
146146
from: "users/<username>"
147-
to: /backups/github/gist
147+
to: /backups/gists
148148
credentials: !Token "your_github_pat"
149149
150150
# Backup all of the public GitHub Gist by a specific user
151151
- kind: github/gist
152152
from: "users/<username>"
153-
to: /backups/github/gist
153+
to: /backups/gists
154154
```
155155

156156
## Filtering

docs/reference/gist.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ backups:
4545

4646
## Filter Fields
4747
Regardless of which backup kind and source you choose, you may use the following fields
48-
in your filter to determine which repositories should be included in your backup. These fields
49-
are accessed using the `repo.<field>` syntax, for example `repo.fork` to determine if a repository
50-
is a fork.
48+
in your filter to determine which gists should be included in your backup. These fields
49+
are accessed using the `gist.<field>` syntax, for example `gist.public` to determine if
50+
the gist is public or not.
5151

5252
::: tip
5353
These fields are also available when using [`github/repo`](./repo.md) or [`github/release`](./release.md) backups.
@@ -61,6 +61,7 @@ These fields are also available when using [`github/repo`](./repo.md) or [`githu
6161
| `gist.comments_enabled` | `boolean` | Whether comments are enabled for the gist |
6262
| `gist.comments` | `integer` | Number of comments on the gist |
6363
| `gist.files` | `integer` | Number of files in the gist |
64+
| `gist.forks` | `integer` | The number of times this gist is forked |
6465
| `gist.file_names` | `array` | List of file names in the gist |
6566
| `gist.languages` | `array` | List of programming languages used in the gist |
66-
| `gist.type` | `string` | Type of content in the gist |
67+
| `gist.type` | `string` | MIME-Type of content in the gist |

src/helpers/github.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ pub struct GitHubGist {
641641
pub html_url: String,
642642
pub comments: u64,
643643
pub user: Option<serde_json::Value>, // `null` in the example
644-
pub comments_enabled: bool,
644+
pub comments_enabled: Option<bool>,
645645
pub comments_url: String,
646646
pub truncated: bool,
647647
pub files: std::collections::HashMap<String, GistFile>,
@@ -830,7 +830,7 @@ mod tests {
830830
}
831831

832832
#[rstest]
833-
#[case("github.gists.0.json", 4)]
833+
#[case("github.gists.0.json", 1)]
834834
fn test_deserialize_gist(#[case] file: &str, #[case] repo_count: usize) {
835835
let gists: Vec<GitHubGist> = load_test_file(file).expect("Failed to load test file");
836836
assert_eq!(gists.len(), repo_count);

tests/data/github.gists.0.json

Lines changed: 34 additions & 183 deletions
Original file line numberDiff line numberDiff line change
@@ -1,198 +1,49 @@
11
[
22
{
3-
"url": "https://api.github.com/gists/ce8e140fdcddcc9a6ac09a92b7ea0909",
4-
"forks_url": "https://api.github.com/gists/ce8e140fdcddcc9a6ac09a92b7ea0909/forks",
5-
"commits_url": "https://api.github.com/gists/ce8e140fdcddcc9a6ac09a92b7ea0909/commits",
6-
"id": "ce8e140fdcddcc9a6ac09a92b7ea0909",
7-
"node_id": "G_kwDOAB3LV9oAIGNlOGUxNDBmZGNkZGNjOWE2YWMwOWE5MmI3ZWEwOTA5",
8-
"git_pull_url": "https://gist.github.com/ce8e140fdcddcc9a6ac09a92b7ea0909.git",
9-
"git_push_url": "https://gist.github.com/ce8e140fdcddcc9a6ac09a92b7ea0909.git",
10-
"html_url": "https://gist.github.com/cedi/ce8e140fdcddcc9a6ac09a92b7ea0909",
3+
"url": "https://api.github.com/gists/aa5a315d61ae9438b18d",
4+
"forks_url": "https://api.github.com/gists/aa5a315d61ae9438b18d/forks",
5+
"commits_url": "https://api.github.com/gists/aa5a315d61ae9438b18d/commits",
6+
"id": "aa5a315d61ae9438b18d",
7+
"node_id": "MDQ6R2lzdGFhNWEzMTVkNjFhZTk0MzhiMThk",
8+
"git_pull_url": "https://gist.github.com/aa5a315d61ae9438b18d.git",
9+
"git_push_url": "https://gist.github.com/aa5a315d61ae9438b18d.git",
10+
"html_url": "https://gist.github.com/aa5a315d61ae9438b18d",
1111
"files": {
12-
"link_cleanup.py": {
13-
"filename": "link_cleanup.py",
14-
"type": "application/x-python",
15-
"language": "Python",
16-
"raw_url": "https://gist.githubusercontent.com/cedi/ce8e140fdcddcc9a6ac09a92b7ea0909/raw/eaf634f479aec1f5268d036e83188f9cdfabcbbb/link_cleanup.py",
17-
"size": 5131
12+
"hello_world.rb": {
13+
"filename": "hello_world.rb",
14+
"type": "application/x-ruby",
15+
"language": "Ruby",
16+
"raw_url": "https://gist.githubusercontent.com/octocat/6cad326836d38bd3a7ae/raw/db9c55113504e46fa076e7df3a04ce592e2e86d8/hello_world.rb",
17+
"size": 167
1818
}
1919
},
2020
"public": true,
21-
"created_at": "2023-03-30T09:13:35Z",
22-
"updated_at": "2023-03-30T11:58:16Z",
23-
"description": "Cleanup Links and Footnotes in Markdown documents",
21+
"created_at": "2010-04-14T02:15:15Z",
22+
"updated_at": "2011-06-20T11:34:15Z",
23+
"description": "Hello World Examples",
2424
"comments": 0,
2525
"user": null,
26-
"comments_enabled": true,
27-
"comments_url": "https://api.github.com/gists/ce8e140fdcddcc9a6ac09a92b7ea0909/comments",
26+
"comments_url": "https://api.github.com/gists/aa5a315d61ae9438b18d/comments/",
2827
"owner": {
29-
"login": "cedi",
30-
"id": 1952599,
31-
"node_id": "MDQ6VXNlcjE5NTI1OTk=",
32-
"avatar_url": "https://avatars.githubusercontent.com/u/1952599?v=4",
28+
"login": "octocat",
29+
"id": 1,
30+
"node_id": "MDQ6VXNlcjE=",
31+
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
3332
"gravatar_id": "",
34-
"url": "https://api.github.com/users/cedi",
35-
"html_url": "https://github.com/cedi",
36-
"followers_url": "https://api.github.com/users/cedi/followers",
37-
"following_url": "https://api.github.com/users/cedi/following{/other_user}",
38-
"gists_url": "https://api.github.com/users/cedi/gists{/gist_id}",
39-
"starred_url": "https://api.github.com/users/cedi/starred{/owner}{/repo}",
40-
"subscriptions_url": "https://api.github.com/users/cedi/subscriptions",
41-
"organizations_url": "https://api.github.com/users/cedi/orgs",
42-
"repos_url": "https://api.github.com/users/cedi/repos",
43-
"events_url": "https://api.github.com/users/cedi/events{/privacy}",
44-
"received_events_url": "https://api.github.com/users/cedi/received_events",
33+
"url": "https://api.github.com/users/octocat",
34+
"html_url": "https://github.com/octocat",
35+
"followers_url": "https://api.github.com/users/octocat/followers",
36+
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
37+
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
38+
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
39+
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
40+
"organizations_url": "https://api.github.com/users/octocat/orgs",
41+
"repos_url": "https://api.github.com/users/octocat/repos",
42+
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
43+
"received_events_url": "https://api.github.com/users/octocat/received_events",
4544
"type": "User",
46-
"user_view_type": "public",
47-
"site_admin": false
48-
},
49-
"truncated": false
50-
},
51-
{
52-
"url": "https://api.github.com/gists/0d50aa06230c3ec6c1aef5f129727743",
53-
"forks_url": "https://api.github.com/gists/0d50aa06230c3ec6c1aef5f129727743/forks",
54-
"commits_url": "https://api.github.com/gists/0d50aa06230c3ec6c1aef5f129727743/commits",
55-
"id": "0d50aa06230c3ec6c1aef5f129727743",
56-
"node_id": "G_kwDOAB3LV9oAIDBkNTBhYTA2MjMwYzNlYzZjMWFlZjVmMTI5NzI3NzQz",
57-
"git_pull_url": "https://gist.github.com/0d50aa06230c3ec6c1aef5f129727743.git",
58-
"git_push_url": "https://gist.github.com/0d50aa06230c3ec6c1aef5f129727743.git",
59-
"html_url": "https://gist.github.com/cedi/0d50aa06230c3ec6c1aef5f129727743",
60-
"files": {
61-
"main.tf": {
62-
"filename": "main.tf",
63-
"type": "text/plain",
64-
"language": "HCL",
65-
"raw_url": "https://gist.githubusercontent.com/cedi/0d50aa06230c3ec6c1aef5f129727743/raw/474cd69ef28ca54a5587a0fd95a64d3a636ac153/main.tf",
66-
"size": 5832
67-
}
68-
},
69-
"public": true,
70-
"created_at": "2022-03-06T23:04:18Z",
71-
"updated_at": "2022-03-06T23:04:18Z",
72-
"description": "Production ready KubeOne Cluster on Hetzner Cloud",
73-
"comments": 0,
74-
"user": null,
75-
"comments_enabled": true,
76-
"comments_url": "https://api.github.com/gists/0d50aa06230c3ec6c1aef5f129727743/comments",
77-
"owner": {
78-
"login": "cedi",
79-
"id": 1952599,
80-
"node_id": "MDQ6VXNlcjE5NTI1OTk=",
81-
"avatar_url": "https://avatars.githubusercontent.com/u/1952599?v=4",
82-
"gravatar_id": "",
83-
"url": "https://api.github.com/users/cedi",
84-
"html_url": "https://github.com/cedi",
85-
"followers_url": "https://api.github.com/users/cedi/followers",
86-
"following_url": "https://api.github.com/users/cedi/following{/other_user}",
87-
"gists_url": "https://api.github.com/users/cedi/gists{/gist_id}",
88-
"starred_url": "https://api.github.com/users/cedi/starred{/owner}{/repo}",
89-
"subscriptions_url": "https://api.github.com/users/cedi/subscriptions",
90-
"organizations_url": "https://api.github.com/users/cedi/orgs",
91-
"repos_url": "https://api.github.com/users/cedi/repos",
92-
"events_url": "https://api.github.com/users/cedi/events{/privacy}",
93-
"received_events_url": "https://api.github.com/users/cedi/received_events",
94-
"type": "User",
95-
"user_view_type": "public",
96-
"site_admin": false
97-
},
98-
"truncated": false
99-
},
100-
{
101-
"url": "https://api.github.com/gists/dee98a454044b192a8d7f4fcdf42c479",
102-
"forks_url": "https://api.github.com/gists/dee98a454044b192a8d7f4fcdf42c479/forks",
103-
"commits_url": "https://api.github.com/gists/dee98a454044b192a8d7f4fcdf42c479/commits",
104-
"id": "dee98a454044b192a8d7f4fcdf42c479",
105-
"node_id": "MDQ6R2lzdGRlZTk4YTQ1NDA0NGIxOTJhOGQ3ZjRmY2RmNDJjNDc5",
106-
"git_pull_url": "https://gist.github.com/dee98a454044b192a8d7f4fcdf42c479.git",
107-
"git_push_url": "https://gist.github.com/dee98a454044b192a8d7f4fcdf42c479.git",
108-
"html_url": "https://gist.github.com/cedi/dee98a454044b192a8d7f4fcdf42c479",
109-
"files": {
110-
"GHIssue.mf": {
111-
"filename": "GHIssue.mf",
112-
"type": "text/plain",
113-
"language": null,
114-
"raw_url": "https://gist.githubusercontent.com/cedi/dee98a454044b192a8d7f4fcdf42c479/raw/a12c27ecd3ca13a95cde9d4ddb409ca4ec72bd10/GHIssue.mf",
115-
"size": 7322
116-
}
117-
},
118-
"public": true,
119-
"created_at": "2021-06-06T22:33:00Z",
120-
"updated_at": "2021-06-06T22:33:01Z",
121-
"description": "",
122-
"comments": 0,
123-
"user": null,
124-
"comments_enabled": true,
125-
"comments_url": "https://api.github.com/gists/dee98a454044b192a8d7f4fcdf42c479/comments",
126-
"owner": {
127-
"login": "cedi",
128-
"id": 1952599,
129-
"node_id": "MDQ6VXNlcjE5NTI1OTk=",
130-
"avatar_url": "https://avatars.githubusercontent.com/u/1952599?v=4",
131-
"gravatar_id": "",
132-
"url": "https://api.github.com/users/cedi",
133-
"html_url": "https://github.com/cedi",
134-
"followers_url": "https://api.github.com/users/cedi/followers",
135-
"following_url": "https://api.github.com/users/cedi/following{/other_user}",
136-
"gists_url": "https://api.github.com/users/cedi/gists{/gist_id}",
137-
"starred_url": "https://api.github.com/users/cedi/starred{/owner}{/repo}",
138-
"subscriptions_url": "https://api.github.com/users/cedi/subscriptions",
139-
"organizations_url": "https://api.github.com/users/cedi/orgs",
140-
"repos_url": "https://api.github.com/users/cedi/repos",
141-
"events_url": "https://api.github.com/users/cedi/events{/privacy}",
142-
"received_events_url": "https://api.github.com/users/cedi/received_events",
143-
"type": "User",
144-
"user_view_type": "public",
145-
"site_admin": false
146-
},
147-
"truncated": false
148-
},
149-
{
150-
"url": "https://api.github.com/gists/ba519c7864755afb3535374d492696d9",
151-
"forks_url": "https://api.github.com/gists/ba519c7864755afb3535374d492696d9/forks",
152-
"commits_url": "https://api.github.com/gists/ba519c7864755afb3535374d492696d9/commits",
153-
"id": "ba519c7864755afb3535374d492696d9",
154-
"node_id": "MDQ6R2lzdGJhNTE5Yzc4NjQ3NTVhZmIzNTM1Mzc0ZDQ5MjY5NmQ5",
155-
"git_pull_url": "https://gist.github.com/ba519c7864755afb3535374d492696d9.git",
156-
"git_push_url": "https://gist.github.com/ba519c7864755afb3535374d492696d9.git",
157-
"html_url": "https://gist.github.com/cedi/ba519c7864755afb3535374d492696d9",
158-
"files": {
159-
"dates_in_pi.ipynb": {
160-
"filename": "dates_in_pi.ipynb",
161-
"type": "text/plain",
162-
"language": "Jupyter Notebook",
163-
"raw_url": "https://gist.githubusercontent.com/cedi/ba519c7864755afb3535374d492696d9/raw/a21d097fc4f1d9274139d4d979b233a70d97b395/dates_in_pi.ipynb",
164-
"size": 52468
165-
}
166-
},
167-
"public": true,
168-
"created_at": "2020-08-30T00:01:20Z",
169-
"updated_at": "2020-08-30T12:34:07Z",
170-
"description": "",
171-
"comments": 0,
172-
"user": null,
173-
"comments_enabled": true,
174-
"comments_url": "https://api.github.com/gists/ba519c7864755afb3535374d492696d9/comments",
175-
"owner": {
176-
"login": "cedi",
177-
"id": 1952599,
178-
"node_id": "MDQ6VXNlcjE5NTI1OTk=",
179-
"avatar_url": "https://avatars.githubusercontent.com/u/1952599?v=4",
180-
"gravatar_id": "",
181-
"url": "https://api.github.com/users/cedi",
182-
"html_url": "https://github.com/cedi",
183-
"followers_url": "https://api.github.com/users/cedi/followers",
184-
"following_url": "https://api.github.com/users/cedi/following{/other_user}",
185-
"gists_url": "https://api.github.com/users/cedi/gists{/gist_id}",
186-
"starred_url": "https://api.github.com/users/cedi/starred{/owner}{/repo}",
187-
"subscriptions_url": "https://api.github.com/users/cedi/subscriptions",
188-
"organizations_url": "https://api.github.com/users/cedi/orgs",
189-
"repos_url": "https://api.github.com/users/cedi/repos",
190-
"events_url": "https://api.github.com/users/cedi/events{/privacy}",
191-
"received_events_url": "https://api.github.com/users/cedi/received_events",
192-
"type": "User",
193-
"user_view_type": "public",
19445
"site_admin": false
19546
},
19647
"truncated": false
19748
}
198-
]
49+
]

0 commit comments

Comments
 (0)