fastlane-plugin-github_api 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +824 -0
- data/lib/fastlane/plugin/github_api/actions/github_add_assignees_action.rb +191 -0
- data/lib/fastlane/plugin/github_api/actions/github_add_issue_comment_action.rb +184 -0
- data/lib/fastlane/plugin/github_api/actions/github_add_labels_action.rb +191 -0
- data/lib/fastlane/plugin/github_api/actions/github_api_action.rb +47 -0
- data/lib/fastlane/plugin/github_api/actions/github_check_pull_merged_action.rb +152 -0
- data/lib/fastlane/plugin/github_api/actions/github_create_commit_comment_reaction_action.rb +168 -0
- data/lib/fastlane/plugin/github_api/actions/github_create_issue_action.rb +199 -0
- data/lib/fastlane/plugin/github_api/actions/github_create_issue_comment_reaction_action.rb +168 -0
- data/lib/fastlane/plugin/github_api/actions/github_create_issue_reaction_action.rb +168 -0
- data/lib/fastlane/plugin/github_api/actions/github_create_label_action.rb +194 -0
- data/lib/fastlane/plugin/github_api/actions/github_create_milestone_action.rb +199 -0
- data/lib/fastlane/plugin/github_api/actions/github_create_pull_action.rb +202 -0
- data/lib/fastlane/plugin/github_api/actions/github_create_pull_comment_action.rb +229 -0
- data/lib/fastlane/plugin/github_api/actions/github_create_pull_comment_reaction_action.rb +168 -0
- data/lib/fastlane/plugin/github_api/actions/github_create_pull_review_action.rb +224 -0
- data/lib/fastlane/plugin/github_api/actions/github_create_repository_action.rb +230 -0
- data/lib/fastlane/plugin/github_api/actions/github_delete_commit_comment_reaction_action.rb +152 -0
- data/lib/fastlane/plugin/github_api/actions/github_delete_issue_comment_action.rb +153 -0
- data/lib/fastlane/plugin/github_api/actions/github_delete_issue_comment_reaction_action.rb +152 -0
- data/lib/fastlane/plugin/github_api/actions/github_delete_issue_reaction_action.rb +152 -0
- data/lib/fastlane/plugin/github_api/actions/github_delete_label_action.rb +164 -0
- data/lib/fastlane/plugin/github_api/actions/github_delete_milestone_action.rb +159 -0
- data/lib/fastlane/plugin/github_api/actions/github_delete_pull_comment_action.rb +144 -0
- data/lib/fastlane/plugin/github_api/actions/github_delete_pull_comment_reaction_action.rb +152 -0
- data/lib/fastlane/plugin/github_api/actions/github_delete_repository_action.rb +166 -0
- data/lib/fastlane/plugin/github_api/actions/github_dismiss_pull_review_action.rb +168 -0
- data/lib/fastlane/plugin/github_api/actions/github_get_issue_action.rb +166 -0
- data/lib/fastlane/plugin/github_api/actions/github_get_issue_comment_action.rb +174 -0
- data/lib/fastlane/plugin/github_api/actions/github_get_issue_event_action.rb +169 -0
- data/lib/fastlane/plugin/github_api/actions/github_get_issue_timeline_action.rb +199 -0
- data/lib/fastlane/plugin/github_api/actions/github_get_milestone_action.rb +167 -0
- data/lib/fastlane/plugin/github_api/actions/github_get_pull_action.rb +150 -0
- data/lib/fastlane/plugin/github_api/actions/github_get_pull_comment_action.rb +147 -0
- data/lib/fastlane/plugin/github_api/actions/github_get_pull_review_action.rb +137 -0
- data/lib/fastlane/plugin/github_api/actions/github_get_pull_review_comments_action.rb +181 -0
- data/lib/fastlane/plugin/github_api/actions/github_list_all_pull_comments_action.rb +186 -0
- data/lib/fastlane/plugin/github_api/actions/github_list_commit_comment_reactions_action.rb +183 -0
- data/lib/fastlane/plugin/github_api/actions/github_list_issue_comment_reactions_action.rb +183 -0
- data/lib/fastlane/plugin/github_api/actions/github_list_issue_comments_action.rb +197 -0
- data/lib/fastlane/plugin/github_api/actions/github_list_issue_events_action.rb +191 -0
- data/lib/fastlane/plugin/github_api/actions/github_list_issue_labels_action.rb +192 -0
- data/lib/fastlane/plugin/github_api/actions/github_list_issue_reactions_action.rb +183 -0
- data/lib/fastlane/plugin/github_api/actions/github_list_issues_action.rb +236 -0
- data/lib/fastlane/plugin/github_api/actions/github_list_milestones_action.rb +205 -0
- data/lib/fastlane/plugin/github_api/actions/github_list_pull_comment_reactions_action.rb +183 -0
- data/lib/fastlane/plugin/github_api/actions/github_list_pull_comments_action.rb +203 -0
- data/lib/fastlane/plugin/github_api/actions/github_list_pull_commits_action.rb +175 -0
- data/lib/fastlane/plugin/github_api/actions/github_list_pull_files_action.rb +174 -0
- data/lib/fastlane/plugin/github_api/actions/github_list_pull_reviewers_action.rb +163 -0
- data/lib/fastlane/plugin/github_api/actions/github_list_pull_reviews_action.rb +175 -0
- data/lib/fastlane/plugin/github_api/actions/github_list_pulls_action.rb +206 -0
- data/lib/fastlane/plugin/github_api/actions/github_list_repo_issue_events_action.rb +185 -0
- data/lib/fastlane/plugin/github_api/actions/github_list_repo_labels_action.rb +184 -0
- data/lib/fastlane/plugin/github_api/actions/github_lock_issue_action.rb +180 -0
- data/lib/fastlane/plugin/github_api/actions/github_merge_pull_action.rb +191 -0
- data/lib/fastlane/plugin/github_api/actions/github_remove_all_labels_action.rb +160 -0
- data/lib/fastlane/plugin/github_api/actions/github_remove_assignees_action.rb +195 -0
- data/lib/fastlane/plugin/github_api/actions/github_remove_label_action.rb +172 -0
- data/lib/fastlane/plugin/github_api/actions/github_remove_pull_reviewers_action.rb +169 -0
- data/lib/fastlane/plugin/github_api/actions/github_request_pull_review_action.rb +169 -0
- data/lib/fastlane/plugin/github_api/actions/github_set_labels_action.rb +191 -0
- data/lib/fastlane/plugin/github_api/actions/github_submit_pull_comment_action.rb +185 -0
- data/lib/fastlane/plugin/github_api/actions/github_submit_pull_review_action.rb +187 -0
- data/lib/fastlane/plugin/github_api/actions/github_unlock_issue_action.rb +157 -0
- data/lib/fastlane/plugin/github_api/actions/github_update_issue_action.rb +202 -0
- data/lib/fastlane/plugin/github_api/actions/github_update_issue_comment_action.rb +172 -0
- data/lib/fastlane/plugin/github_api/actions/github_update_label_action.rb +204 -0
- data/lib/fastlane/plugin/github_api/actions/github_update_milestone_action.rb +198 -0
- data/lib/fastlane/plugin/github_api/actions/github_update_pull_action.rb +191 -0
- data/lib/fastlane/plugin/github_api/actions/github_update_pull_branch_action.rb +158 -0
- data/lib/fastlane/plugin/github_api/actions/github_update_pull_comment_action.rb +156 -0
- data/lib/fastlane/plugin/github_api/actions/github_update_pull_review_action.rb +151 -0
- data/lib/fastlane/plugin/github_api/helper/github_api_helper.rb +123 -0
- data/lib/fastlane/plugin/github_api/version.rb +5 -0
- data/lib/fastlane/plugin/github_api.rb +16 -0
- metadata +120 -0
data/README.md
ADDED
@@ -0,0 +1,824 @@
|
|
1
|
+
# GitHub API Plugin for Fastlane
|
2
|
+
|
3
|
+
[](https://rubygems.org/gems/fastlane-plugin-github_api)
|
4
|
+
[](https://badge.fury.io/rb/fastlane-plugin-github_api)
|
5
|
+
[](LICENSE)
|
6
|
+
|
7
|
+
## Table of Contents
|
8
|
+
|
9
|
+
- [Overview](#about-github_api)
|
10
|
+
- [Installation](#getting-started)
|
11
|
+
- [Available Actions](#available-actions)
|
12
|
+
- [Issues](#issues)
|
13
|
+
- [Pull Requests](#pull-requests)
|
14
|
+
- [Repositories](#repositories)
|
15
|
+
- [Reactions](#reactions)
|
16
|
+
- [Return Values](#return-values)
|
17
|
+
- [Authentication](#authentication)
|
18
|
+
- [Example Usage](#example)
|
19
|
+
- [Development](#run-tests-for-this-plugin)
|
20
|
+
- [Troubleshooting](#troubleshooting)
|
21
|
+
|
22
|
+
## Getting Started
|
23
|
+
|
24
|
+
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-github_api`, add it to your project by running:
|
25
|
+
|
26
|
+
```bash
|
27
|
+
fastlane add_plugin github_api
|
28
|
+
```
|
29
|
+
|
30
|
+
### Requirements
|
31
|
+
|
32
|
+
- Ruby 2.5.0 or higher
|
33
|
+
- Fastlane 2.170.0 or higher
|
34
|
+
|
35
|
+
## About github_api
|
36
|
+
|
37
|
+
A comprehensive Fastlane plugin for interacting with GitHub's REST APIs. This plugin enables automation of GitHub-related tasks directly from your Fastlane workflows, including managing issues, pull requests, repositories, labels, milestones, and more.
|
38
|
+
|
39
|
+
### Key Features
|
40
|
+
|
41
|
+
- Full coverage of GitHub REST API endpoints for common operations
|
42
|
+
- Consistent Ruby-style interface for all GitHub interactions
|
43
|
+
- Detailed error handling and response parsing
|
44
|
+
- Shared lane context values for chaining multiple actions
|
45
|
+
- Comprehensive documentation and examples
|
46
|
+
|
47
|
+
## Available Actions
|
48
|
+
|
49
|
+
### Issues
|
50
|
+
- `github_add_assignees`: Add assignees to an issue.
|
51
|
+
- `github_add_labels`: Add labels to an issue.
|
52
|
+
- `github_create_issue`: Create a new issue.
|
53
|
+
- `github_create_issue_comment_reaction`: Create a reaction for an issue comment.
|
54
|
+
- `github_create_issue_reaction`: Create a reaction for an issue.
|
55
|
+
- `github_delete_issue_comment`: Delete an issue comment.
|
56
|
+
- `github_delete_issue_comment_reaction`: Delete a reaction from an issue comment.
|
57
|
+
- `github_delete_issue_reaction`: Delete a reaction from an issue.
|
58
|
+
- `github_get_issue`: Get a single issue.
|
59
|
+
- `github_get_issue_comment`: Get a single issue comment.
|
60
|
+
- `github_get_issue_event`: Get a single issue event.
|
61
|
+
- `github_get_issue_timeline`: List events for an issue timeline.
|
62
|
+
- `github_list_issue_comment_reactions`: List reactions for an issue comment.
|
63
|
+
- `github_list_issue_comments`: List comments on an issue.
|
64
|
+
- `github_list_issue_labels`: List labels on an issue.
|
65
|
+
- `github_list_issue_reactions`: List reactions for an issue.
|
66
|
+
- `github_list_issues`: List issues in a repository.
|
67
|
+
- `github_lock_issue`: Lock an issue.
|
68
|
+
- `github_remove_all_labels`: Remove all labels from an issue.
|
69
|
+
- `github_remove_assignees`: Remove assignees from an issue.
|
70
|
+
- `github_remove_label`: Remove a label from an issue.
|
71
|
+
- `github_set_labels`: Set labels for an issue.
|
72
|
+
- `github_unlock_issue`: Unlock an issue.
|
73
|
+
- `github_update_issue`: Update an issue.
|
74
|
+
- `github_update_issue_comment`: Update an issue comment.
|
75
|
+
|
76
|
+
### Pull Requests
|
77
|
+
- `github_check_pull_merged`: Check if a pull request has been merged.
|
78
|
+
- `github_create_pull`: Create a pull request.
|
79
|
+
- `github_create_pull_comment`: Create a review comment for a pull request.
|
80
|
+
- `github_create_pull_comment_reaction`: Create a reaction for a pull request review comment.
|
81
|
+
- `github_create_pull_review`: Create a review for a pull request.
|
82
|
+
- `github_delete_pull_comment`: Delete a pull request review comment.
|
83
|
+
- `github_delete_pull_comment_reaction`: Delete a reaction from a pull request review comment.
|
84
|
+
- `github_dismiss_pull_review`: Dismiss a pull request review.
|
85
|
+
- `github_get_pull`: Get a single pull request.
|
86
|
+
- `github_get_pull_comment`: Get a single pull request review comment.
|
87
|
+
- `github_get_pull_review`: Get a single pull request review.
|
88
|
+
- `github_get_pull_review_comments`: List comments for a pull request review.
|
89
|
+
- `github_list_all_pull_comments`: List all pull request review comments in a repository.
|
90
|
+
- `github_list_pull_comment_reactions`: List reactions for a pull request review comment.
|
91
|
+
- `github_list_pull_comments`: List review comments on a pull request.
|
92
|
+
- `github_list_pull_commits`: List commits on a pull request.
|
93
|
+
- `github_list_pull_files`: List files on a pull request.
|
94
|
+
- `github_list_pull_reviewers`: List requested reviewers for a pull request.
|
95
|
+
- `github_list_pull_reviews`: List reviews on a pull request.
|
96
|
+
- `github_list_pulls`: List pull requests in a repository.
|
97
|
+
- `github_merge_pull`: Merge a pull request.
|
98
|
+
- `github_request_pull_review`: Request reviewers for a pull request.
|
99
|
+
- `github_remove_pull_reviewers`: Remove requested reviewers from a pull request.
|
100
|
+
- `github_submit_pull_review`: Submit a review for a pull request.
|
101
|
+
- `github_update_pull`: Update a pull request.
|
102
|
+
- `github_update_pull_branch`: Update a pull request branch.
|
103
|
+
- `github_update_pull_comment`: Update a pull request review comment.
|
104
|
+
- `github_update_pull_review`: Update a pull request review.
|
105
|
+
|
106
|
+
### Repositories
|
107
|
+
- `github_create_repository`: Create a new repository.
|
108
|
+
- `github_delete_repository`: Delete a repository.
|
109
|
+
- `github_list_repo_labels`: List labels for a repository.
|
110
|
+
- `github_list_repo_issue_events`: List issue events for a repository.
|
111
|
+
- `github_list_milestones`: List milestones for a repository.
|
112
|
+
- `github_create_label`: Create a label.
|
113
|
+
- `github_update_label`: Update a label.
|
114
|
+
- `github_delete_label`: Delete a label.
|
115
|
+
- `github_create_milestone`: Create a milestone.
|
116
|
+
- `github_update_milestone`: Update a milestone.
|
117
|
+
- `github_delete_milestone`: Delete a milestone.
|
118
|
+
|
119
|
+
### Reactions
|
120
|
+
- `github_create_commit_comment_reaction`: Create a reaction for a commit comment.
|
121
|
+
- `github_delete_commit_comment_reaction`: Delete a reaction from a commit comment.
|
122
|
+
- `github_list_commit_comment_reactions`: List reactions for a commit comment.
|
123
|
+
|
124
|
+
## Return Values
|
125
|
+
|
126
|
+
All actions return a hash with the following keys:
|
127
|
+
- `:status` - The HTTP status code
|
128
|
+
- `:body` - The raw response body
|
129
|
+
- `:json` - Parsed JSON response (if applicable)
|
130
|
+
|
131
|
+
Most actions also set shared lane context values that can be accessed in subsequent steps:
|
132
|
+
|
133
|
+
```ruby
|
134
|
+
result = github_create_issue(...)
|
135
|
+
puts "Issue number: #{Actions.lane_context[SharedValues::GITHUB_CREATE_ISSUE_JSON]['number']}"
|
136
|
+
```
|
137
|
+
|
138
|
+
## Authentication
|
139
|
+
|
140
|
+
All actions require GitHub authentication via a Personal Access Token:
|
141
|
+
|
142
|
+
```ruby
|
143
|
+
ENV["GITHUB_API_TOKEN"] = "your-token-here" # Set in your environment
|
144
|
+
|
145
|
+
# Or pass directly to actions
|
146
|
+
github_create_issue(
|
147
|
+
api_token: "your-token-token",
|
148
|
+
# other parameters...
|
149
|
+
)
|
150
|
+
```
|
151
|
+
|
152
|
+
You can create a GitHub Personal Access Token at https://github.com/settings/tokens.
|
153
|
+
|
154
|
+
### Token Permissions
|
155
|
+
|
156
|
+
For most operations, your token will need the following scopes:
|
157
|
+
- `repo` - Full control of private repositories
|
158
|
+
- `admin:org` - For organization-related operations
|
159
|
+
- `user` - For user-related operations
|
160
|
+
|
161
|
+
For specific operations, refer to [GitHub's documentation on token scopes](https://docs.github.com/en/developers/apps/scopes-for-oauth-apps).
|
162
|
+
|
163
|
+
## Example
|
164
|
+
|
165
|
+
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
|
166
|
+
|
167
|
+
### Sample Usage
|
168
|
+
|
169
|
+
```ruby
|
170
|
+
# In your Fastfile
|
171
|
+
lane :create_release_issue do
|
172
|
+
github_create_issue(
|
173
|
+
repo_owner: "your-username",
|
174
|
+
repo_name: "your-repo",
|
175
|
+
title: "Release version #{lane_context[SharedValues::VERSION_NUMBER]}",
|
176
|
+
body: "Please review the following changes for this release...",
|
177
|
+
labels: ["release", "needs-review"]
|
178
|
+
)
|
179
|
+
end
|
180
|
+
|
181
|
+
lane :submit_pr_review do
|
182
|
+
github_submit_pull_review(
|
183
|
+
repo_owner: "your-username",
|
184
|
+
repo_name: "your-repo",
|
185
|
+
pull_number: 42,
|
186
|
+
event: "APPROVE",
|
187
|
+
body: "LGTM! :rocket:"
|
188
|
+
)
|
189
|
+
end
|
190
|
+
```
|
191
|
+
|
192
|
+
## Run tests for this plugin
|
193
|
+
|
194
|
+
To run both the tests, and code style validation, run:
|
195
|
+
|
196
|
+
```
|
197
|
+
rake
|
198
|
+
```
|
199
|
+
|
200
|
+
To automatically fix many of the styling issues, use:
|
201
|
+
```
|
202
|
+
rubocop -a
|
203
|
+
```
|
204
|
+
|
205
|
+
## Issues and Feedback
|
206
|
+
|
207
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
208
|
+
|
209
|
+
## Troubleshooting
|
210
|
+
|
211
|
+
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
212
|
+
|
213
|
+
## Common Issues
|
214
|
+
|
215
|
+
### Authentication Problems
|
216
|
+
- Make sure your GitHub token has the correct permissions
|
217
|
+
- Check that your token is valid and not expired
|
218
|
+
- Verify the token is correctly set as an environment variable or passed to the action
|
219
|
+
|
220
|
+
### Rate Limiting
|
221
|
+
- GitHub API has rate limits that might affect high-frequency usage
|
222
|
+
- Consider implementing retry logic or rate limit handling
|
223
|
+
|
224
|
+
## Using _fastlane_ Plugins
|
225
|
+
|
226
|
+
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
227
|
+
|
228
|
+
## About _fastlane_
|
229
|
+
|
230
|
+
_fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
|
231
|
+
|
232
|
+
## Complete Action Reference Guide
|
233
|
+
|
234
|
+
This comprehensive reference guide provides detailed usage examples, required parameters, and expected outputs for all actions available in the GitHub API plugin. Use these examples as templates for your own Fastlane workflows.
|
235
|
+
|
236
|
+
### Issues
|
237
|
+
|
238
|
+
#### `github_add_assignees`
|
239
|
+
Add one or more assignees to a GitHub issue.
|
240
|
+
|
241
|
+
```ruby
|
242
|
+
github_add_assignees(
|
243
|
+
api_token: "<your_github_token>",
|
244
|
+
repo_owner: "octocat",
|
245
|
+
repo_name: "Hello-World",
|
246
|
+
issue_number: 42,
|
247
|
+
assignees: ["octocat", "hubot"]
|
248
|
+
)
|
249
|
+
```
|
250
|
+
|
251
|
+
#### `github_add_labels`
|
252
|
+
Add one or more labels to a GitHub issue.
|
253
|
+
|
254
|
+
```ruby
|
255
|
+
github_add_labels(
|
256
|
+
api_token: "<your_github_token>",
|
257
|
+
repo_owner: "octocat",
|
258
|
+
repo_name: "Hello-World",
|
259
|
+
issue_number: 42,
|
260
|
+
labels: ["bug", "help wanted"]
|
261
|
+
)
|
262
|
+
```
|
263
|
+
|
264
|
+
#### `github_create_issue`
|
265
|
+
Create a new GitHub issue.
|
266
|
+
|
267
|
+
```ruby
|
268
|
+
github_create_issue(
|
269
|
+
api_token: "<your_github_token>",
|
270
|
+
repo_owner: "octocat",
|
271
|
+
repo_name: "Hello-World",
|
272
|
+
title: "Found a bug",
|
273
|
+
body: "This is a description of the bug.",
|
274
|
+
labels: ["bug"],
|
275
|
+
assignees: ["octocat"],
|
276
|
+
milestone: 1
|
277
|
+
)
|
278
|
+
```
|
279
|
+
|
280
|
+
#### `github_get_issue`
|
281
|
+
Get a single GitHub issue.
|
282
|
+
|
283
|
+
```ruby
|
284
|
+
issue = github_get_issue(
|
285
|
+
api_token: "<your_github_token>",
|
286
|
+
repo_owner: "octocat",
|
287
|
+
repo_name: "Hello-World",
|
288
|
+
issue_number: 42
|
289
|
+
)
|
290
|
+
|
291
|
+
puts "Issue title: #{issue[:json]['title']}"
|
292
|
+
puts "Issue state: #{issue[:json]['state']}"
|
293
|
+
```
|
294
|
+
|
295
|
+
#### `github_update_issue`
|
296
|
+
Update an existing issue.
|
297
|
+
|
298
|
+
```ruby
|
299
|
+
github_update_issue(
|
300
|
+
api_token: "<your_github_token>",
|
301
|
+
repo_owner: "octocat",
|
302
|
+
repo_name: "Hello-World",
|
303
|
+
issue_number: 42,
|
304
|
+
title: "Updated issue title",
|
305
|
+
body: "Updated description",
|
306
|
+
state: "closed", # "open" or "closed"
|
307
|
+
labels: ["bug", "wontfix"],
|
308
|
+
assignees: ["octocat"],
|
309
|
+
milestone: 2
|
310
|
+
)
|
311
|
+
```
|
312
|
+
|
313
|
+
#### `github_list_issues`
|
314
|
+
List issues in a repository.
|
315
|
+
|
316
|
+
```ruby
|
317
|
+
issues = github_list_issues(
|
318
|
+
api_token: "<your_github_token>",
|
319
|
+
repo_owner: "octocat",
|
320
|
+
repo_name: "Hello-World",
|
321
|
+
state: "open", # "open", "closed", or "all"
|
322
|
+
sort: "created", # "created", "updated", "comments"
|
323
|
+
direction: "desc", # "asc" or "desc"
|
324
|
+
since: "2023-01-01T00:00:00Z", # Optional
|
325
|
+
labels: "bug,enhancement", # Optional
|
326
|
+
assignee: "octocat", # Optional
|
327
|
+
creator: "octocat", # Optional
|
328
|
+
mentioned: "octocat", # Optional
|
329
|
+
milestone: 1 # Optional
|
330
|
+
)
|
331
|
+
|
332
|
+
issues[:json].each do |issue|
|
333
|
+
puts "##{issue['number']} - #{issue['title']} (#{issue['state']})"
|
334
|
+
end
|
335
|
+
```
|
336
|
+
|
337
|
+
#### `github_add_issue_comment`
|
338
|
+
Add a comment to a GitHub issue.
|
339
|
+
|
340
|
+
```ruby
|
341
|
+
github_add_issue_comment(
|
342
|
+
api_token: "<your_github_token>",
|
343
|
+
repo_owner: "octocat",
|
344
|
+
repo_name: "Hello-World",
|
345
|
+
issue_number: 42,
|
346
|
+
body: "This is a comment on the issue."
|
347
|
+
)
|
348
|
+
```
|
349
|
+
|
350
|
+
#### `github_list_issue_comments`
|
351
|
+
List comments on an issue.
|
352
|
+
|
353
|
+
```ruby
|
354
|
+
comments = github_list_issue_comments(
|
355
|
+
api_token: "<your_github_token>",
|
356
|
+
repo_owner: "octocat",
|
357
|
+
repo_name: "Hello-World",
|
358
|
+
issue_number: 42,
|
359
|
+
since: "2023-01-01T00:00:00Z" # Optional
|
360
|
+
)
|
361
|
+
|
362
|
+
comments[:json].each do |comment|
|
363
|
+
puts "Comment by #{comment['user']['login']}: #{comment['body']}"
|
364
|
+
end
|
365
|
+
```
|
366
|
+
|
367
|
+
### Pull Requests
|
368
|
+
|
369
|
+
#### `github_create_pull`
|
370
|
+
Create a new pull request.
|
371
|
+
|
372
|
+
```ruby
|
373
|
+
pull = github_create_pull(
|
374
|
+
api_token: "<your_github_token>",
|
375
|
+
repo_owner: "octocat",
|
376
|
+
repo_name: "Hello-World",
|
377
|
+
title: "Amazing new feature",
|
378
|
+
body: "Please pull these awesome changes in!",
|
379
|
+
head: "octocat:feature-branch",
|
380
|
+
base: "main",
|
381
|
+
draft: false,
|
382
|
+
maintainer_can_modify: true
|
383
|
+
)
|
384
|
+
|
385
|
+
puts "Created PR ##{pull[:json]['number']}"
|
386
|
+
```
|
387
|
+
|
388
|
+
#### `github_get_pull`
|
389
|
+
Get a single pull request.
|
390
|
+
|
391
|
+
```ruby
|
392
|
+
pull = github_get_pull(
|
393
|
+
api_token: "<your_github_token>",
|
394
|
+
repo_owner: "octocat",
|
395
|
+
repo_name: "Hello-World",
|
396
|
+
pull_number: 42
|
397
|
+
)
|
398
|
+
|
399
|
+
puts "PR Title: #{pull[:json]['title']}"
|
400
|
+
puts "Branch: #{pull[:json]['head']['ref']} -> #{pull[:json]['base']['ref']}"
|
401
|
+
puts "State: #{pull[:json]['state']}"
|
402
|
+
```
|
403
|
+
|
404
|
+
#### `github_update_pull`
|
405
|
+
Update a pull request.
|
406
|
+
|
407
|
+
```ruby
|
408
|
+
github_update_pull(
|
409
|
+
api_token: "<your_github_token>",
|
410
|
+
repo_owner: "octocat",
|
411
|
+
repo_name: "Hello-World",
|
412
|
+
pull_number: 42,
|
413
|
+
title: "Updated pull request title",
|
414
|
+
body: "Updated description",
|
415
|
+
state: "closed", # "open" or "closed"
|
416
|
+
base: "main", # Branch to merge changes into
|
417
|
+
maintainer_can_modify: true
|
418
|
+
)
|
419
|
+
```
|
420
|
+
|
421
|
+
#### `github_list_pulls`
|
422
|
+
List pull requests in a repository.
|
423
|
+
|
424
|
+
```ruby
|
425
|
+
pulls = github_list_pulls(
|
426
|
+
api_token: "<your_github_token>",
|
427
|
+
repo_owner: "octocat",
|
428
|
+
repo_name: "Hello-World",
|
429
|
+
state: "open", # "open", "closed", "all"
|
430
|
+
head: "octocat:feature", # Optional filter by head branch
|
431
|
+
base: "main", # Optional filter by base branch
|
432
|
+
sort: "created", # "created", "updated", "popularity", "long-running"
|
433
|
+
direction: "desc" # "asc" or "desc"
|
434
|
+
)
|
435
|
+
|
436
|
+
pulls[:json].each do |pull|
|
437
|
+
puts "PR ##{pull['number']}: #{pull['title']}"
|
438
|
+
end
|
439
|
+
```
|
440
|
+
|
441
|
+
#### `github_merge_pull`
|
442
|
+
Merge a pull request.
|
443
|
+
|
444
|
+
```ruby
|
445
|
+
github_merge_pull(
|
446
|
+
api_token: "<your_github_token>",
|
447
|
+
repo_owner: "octocat",
|
448
|
+
repo_name: "Hello-World",
|
449
|
+
pull_number: 42,
|
450
|
+
commit_title: "Merge pull request #42", # Optional
|
451
|
+
commit_message: "Merge pull request #42 from octocat/feature", # Optional
|
452
|
+
merge_method: "merge" # "merge", "squash", or "rebase"
|
453
|
+
)
|
454
|
+
```
|
455
|
+
|
456
|
+
#### `github_check_pull_merged`
|
457
|
+
Check if a pull request has been merged.
|
458
|
+
|
459
|
+
```ruby
|
460
|
+
result = github_check_pull_merged(
|
461
|
+
api_token: "<your_github_token>",
|
462
|
+
repo_owner: "octocat",
|
463
|
+
repo_name: "Hello-World",
|
464
|
+
pull_number: 42
|
465
|
+
)
|
466
|
+
|
467
|
+
if result[:status] == 204
|
468
|
+
UI.success "Pull request has been merged!"
|
469
|
+
else
|
470
|
+
UI.message "Pull request has not been merged."
|
471
|
+
end
|
472
|
+
```
|
473
|
+
|
474
|
+
#### `github_list_pull_commits`
|
475
|
+
List commits on a pull request.
|
476
|
+
|
477
|
+
```ruby
|
478
|
+
commits = github_list_pull_commits(
|
479
|
+
api_token: "<your_github_token>",
|
480
|
+
repo_owner: "octocat",
|
481
|
+
repo_name: "Hello-World",
|
482
|
+
pull_number: 42
|
483
|
+
)
|
484
|
+
|
485
|
+
commits[:json].each do |commit|
|
486
|
+
puts "Commit SHA: #{commit['sha']}"
|
487
|
+
puts "Author: #{commit['commit']['author']['name']}"
|
488
|
+
puts "Message: #{commit['commit']['message']}"
|
489
|
+
end
|
490
|
+
```
|
491
|
+
|
492
|
+
#### `github_list_pull_files`
|
493
|
+
List files on a pull request.
|
494
|
+
|
495
|
+
```ruby
|
496
|
+
files = github_list_pull_files(
|
497
|
+
api_token: "<your_github_token>",
|
498
|
+
repo_owner: "octocat",
|
499
|
+
repo_name: "Hello-World",
|
500
|
+
pull_number: 42
|
501
|
+
)
|
502
|
+
|
503
|
+
files[:json].each do |file|
|
504
|
+
puts "File: #{file['filename']}"
|
505
|
+
puts "Status: #{file['status']}"
|
506
|
+
puts "Additions: #{file['additions']}, Deletions: #{file['deletions']}, Changes: #{file['changes']}"
|
507
|
+
end
|
508
|
+
```
|
509
|
+
|
510
|
+
### Repositories
|
511
|
+
|
512
|
+
#### `github_create_repository`
|
513
|
+
Create a new repository.
|
514
|
+
|
515
|
+
```ruby
|
516
|
+
github_create_repository(
|
517
|
+
api_token: "<your_github_token>",
|
518
|
+
name: "new-repo",
|
519
|
+
description: "This is a new repository",
|
520
|
+
private: false,
|
521
|
+
has_issues: true,
|
522
|
+
has_projects: true,
|
523
|
+
has_wiki: true,
|
524
|
+
auto_init: true,
|
525
|
+
gitignore_template: "Ruby",
|
526
|
+
license_template: "mit",
|
527
|
+
organization: "octo-org" # Optional, create in organization instead of user account
|
528
|
+
)
|
529
|
+
```
|
530
|
+
|
531
|
+
#### `github_delete_repository`
|
532
|
+
Delete a repository.
|
533
|
+
|
534
|
+
```ruby
|
535
|
+
github_delete_repository(
|
536
|
+
api_token: "<your_github_token>",
|
537
|
+
repo_owner: "octocat",
|
538
|
+
repo_name: "Hello-World"
|
539
|
+
)
|
540
|
+
```
|
541
|
+
|
542
|
+
#### `github_list_repo_labels`
|
543
|
+
List labels for a repository.
|
544
|
+
|
545
|
+
```ruby
|
546
|
+
labels = github_list_repo_labels(
|
547
|
+
api_token: "<your_github_token>",
|
548
|
+
repo_owner: "octocat",
|
549
|
+
repo_name: "Hello-World"
|
550
|
+
)
|
551
|
+
|
552
|
+
labels[:json].each do |label|
|
553
|
+
puts "Label: #{label['name']} (#{label['color']})"
|
554
|
+
end
|
555
|
+
```
|
556
|
+
|
557
|
+
#### `github_create_label`
|
558
|
+
Create a label in a repository.
|
559
|
+
|
560
|
+
```ruby
|
561
|
+
github_create_label(
|
562
|
+
api_token: "<your_github_token>",
|
563
|
+
repo_owner: "octocat",
|
564
|
+
repo_name: "Hello-World",
|
565
|
+
name: "bug",
|
566
|
+
color: "f29513",
|
567
|
+
description: "Something isn't working" # Optional
|
568
|
+
)
|
569
|
+
```
|
570
|
+
|
571
|
+
#### `github_update_label`
|
572
|
+
Update a label in a repository.
|
573
|
+
|
574
|
+
```ruby
|
575
|
+
github_update_label(
|
576
|
+
api_token: "<your_github_token>",
|
577
|
+
repo_owner: "octocat",
|
578
|
+
repo_name: "Hello-World",
|
579
|
+
name: "bug",
|
580
|
+
new_name: "confirmed-bug", # Optional, only if changing the name
|
581
|
+
color: "b60205",
|
582
|
+
description: "Confirmed bugs that need to be fixed"
|
583
|
+
)
|
584
|
+
```
|
585
|
+
|
586
|
+
#### `github_delete_label`
|
587
|
+
Delete a label from a repository.
|
588
|
+
|
589
|
+
```ruby
|
590
|
+
github_delete_label(
|
591
|
+
api_token: "<your_github_token>",
|
592
|
+
repo_owner: "octocat",
|
593
|
+
repo_name: "Hello-World",
|
594
|
+
name: "wontfix"
|
595
|
+
)
|
596
|
+
```
|
597
|
+
|
598
|
+
#### `github_list_milestones`
|
599
|
+
List milestones for a repository.
|
600
|
+
|
601
|
+
```ruby
|
602
|
+
milestones = github_list_milestones(
|
603
|
+
api_token: "<your_github_token>",
|
604
|
+
repo_owner: "octocat",
|
605
|
+
repo_name: "Hello-World",
|
606
|
+
state: "open", # "open", "closed", "all"
|
607
|
+
sort: "due_on", # "due_on" or "completeness"
|
608
|
+
direction: "asc" # "asc" or "desc"
|
609
|
+
)
|
610
|
+
|
611
|
+
milestones[:json].each do |milestone|
|
612
|
+
puts "Milestone: #{milestone['title']} (#{milestone['state']})"
|
613
|
+
puts "Due on: #{milestone['due_on']}"
|
614
|
+
end
|
615
|
+
```
|
616
|
+
|
617
|
+
#### `github_create_milestone`
|
618
|
+
Create a milestone in a repository.
|
619
|
+
|
620
|
+
```ruby
|
621
|
+
github_create_milestone(
|
622
|
+
api_token: "<your_github_token>",
|
623
|
+
repo_owner: "octocat",
|
624
|
+
repo_name: "Hello-World",
|
625
|
+
title: "v1.0",
|
626
|
+
state: "open", # "open" or "closed"
|
627
|
+
description: "Tracking milestone for version 1.0",
|
628
|
+
due_on: "2023-12-31T23:59:59Z" # Optional due date
|
629
|
+
)
|
630
|
+
```
|
631
|
+
|
632
|
+
#### `github_update_milestone`
|
633
|
+
Update a milestone in a repository.
|
634
|
+
|
635
|
+
```ruby
|
636
|
+
github_update_milestone(
|
637
|
+
api_token: "<your_github_token>",
|
638
|
+
repo_owner: "octocat",
|
639
|
+
repo_name: "Hello-World",
|
640
|
+
milestone_number: 1,
|
641
|
+
title: "Updated title", # Optional
|
642
|
+
state: "closed", # Optional, "open" or "closed"
|
643
|
+
description: "Updated description", # Optional
|
644
|
+
due_on: "2024-01-31T23:59:59Z" # Optional due date
|
645
|
+
)
|
646
|
+
```
|
647
|
+
|
648
|
+
#### `github_delete_milestone`
|
649
|
+
Delete a milestone from a repository.
|
650
|
+
|
651
|
+
```ruby
|
652
|
+
github_delete_milestone(
|
653
|
+
api_token: "<your_github_token>",
|
654
|
+
repo_owner: "octocat",
|
655
|
+
repo_name: "Hello-World",
|
656
|
+
milestone_number: 1
|
657
|
+
)
|
658
|
+
```
|
659
|
+
|
660
|
+
### Reactions
|
661
|
+
|
662
|
+
#### `github_create_issue_reaction`
|
663
|
+
Create a reaction for an issue.
|
664
|
+
|
665
|
+
```ruby
|
666
|
+
github_create_issue_reaction(
|
667
|
+
api_token: "<your_github_token>",
|
668
|
+
repo_owner: "octocat",
|
669
|
+
repo_name: "Hello-World",
|
670
|
+
issue_number: 42,
|
671
|
+
content: "+1" # Available reactions: +1, -1, laugh, confused, heart, hooray, rocket, eyes
|
672
|
+
)
|
673
|
+
```
|
674
|
+
|
675
|
+
#### `github_list_issue_reactions`
|
676
|
+
List reactions for an issue.
|
677
|
+
|
678
|
+
```ruby
|
679
|
+
reactions = github_list_issue_reactions(
|
680
|
+
api_token: "<your_github_token>",
|
681
|
+
repo_owner: "octocat",
|
682
|
+
repo_name: "Hello-World",
|
683
|
+
issue_number: 42,
|
684
|
+
content: "+1" # Optional filter by reaction type
|
685
|
+
)
|
686
|
+
|
687
|
+
puts "Total reactions: #{reactions[:json].count}"
|
688
|
+
```
|
689
|
+
|
690
|
+
#### `github_delete_issue_reaction`
|
691
|
+
Delete a reaction from an issue.
|
692
|
+
|
693
|
+
```ruby
|
694
|
+
github_delete_issue_reaction(
|
695
|
+
api_token: "<your_github_token>",
|
696
|
+
repo_owner: "octocat",
|
697
|
+
repo_name: "Hello-World",
|
698
|
+
issue_number: 42,
|
699
|
+
reaction_id: 12345
|
700
|
+
)
|
701
|
+
```
|
702
|
+
|
703
|
+
#### `github_create_issue_comment_reaction`
|
704
|
+
Create a reaction for an issue comment.
|
705
|
+
|
706
|
+
```ruby
|
707
|
+
github_create_issue_comment_reaction(
|
708
|
+
api_token: "<your_github_token>",
|
709
|
+
repo_owner: "octocat",
|
710
|
+
repo_name: "Hello-World",
|
711
|
+
comment_id: 123456,
|
712
|
+
content: "heart" # Available reactions: +1, -1, laugh, confused, heart, hooray, rocket, eyes
|
713
|
+
)
|
714
|
+
```
|
715
|
+
|
716
|
+
#### `github_list_issue_comment_reactions`
|
717
|
+
List reactions for an issue comment.
|
718
|
+
|
719
|
+
```ruby
|
720
|
+
reactions = github_list_issue_comment_reactions(
|
721
|
+
api_token: "<your_github_token>",
|
722
|
+
repo_owner: "octocat",
|
723
|
+
repo_name: "Hello-World",
|
724
|
+
comment_id: 123456,
|
725
|
+
content: "heart" # Optional filter by reaction type
|
726
|
+
)
|
727
|
+
|
728
|
+
puts "Total reactions: #{reactions[:json].count}"
|
729
|
+
```
|
730
|
+
|
731
|
+
#### `github_delete_issue_comment_reaction`
|
732
|
+
Delete a reaction from an issue comment.
|
733
|
+
|
734
|
+
```ruby
|
735
|
+
github_delete_issue_comment_reaction(
|
736
|
+
api_token: "<your_github_token>",
|
737
|
+
repo_owner: "octocat",
|
738
|
+
repo_name: "Hello-World",
|
739
|
+
comment_id: 123456,
|
740
|
+
reaction_id: 12345
|
741
|
+
)
|
742
|
+
```
|
743
|
+
|
744
|
+
#### `github_create_pull_comment_reaction`
|
745
|
+
Create a reaction for a pull request review comment.
|
746
|
+
|
747
|
+
```ruby
|
748
|
+
github_create_pull_comment_reaction(
|
749
|
+
api_token: "<your_github_token>",
|
750
|
+
repo_owner: "octocat",
|
751
|
+
repo_name: "Hello-World",
|
752
|
+
comment_id: 123456,
|
753
|
+
content: "heart" # Available reactions: +1, -1, laugh, confused, heart, hooray, rocket, eyes
|
754
|
+
)
|
755
|
+
```
|
756
|
+
|
757
|
+
#### `github_list_pull_comment_reactions`
|
758
|
+
List reactions for a pull request review comment.
|
759
|
+
|
760
|
+
```ruby
|
761
|
+
reactions = github_list_pull_comment_reactions(
|
762
|
+
api_token: "<your_github_token>",
|
763
|
+
repo_owner: "octocat",
|
764
|
+
repo_name: "Hello-World",
|
765
|
+
comment_id: 123456,
|
766
|
+
content: "heart" # Optional filter by reaction type
|
767
|
+
)
|
768
|
+
|
769
|
+
puts "Total reactions: #{reactions[:json].count}"
|
770
|
+
```
|
771
|
+
|
772
|
+
#### `github_delete_pull_comment_reaction`
|
773
|
+
Delete a reaction from a pull request review comment.
|
774
|
+
|
775
|
+
```ruby
|
776
|
+
github_delete_pull_comment_reaction(
|
777
|
+
api_token: "<your_github_token>",
|
778
|
+
repo_owner: "octocat",
|
779
|
+
repo_name: "Hello-World",
|
780
|
+
comment_id: 123456,
|
781
|
+
reaction_id: 12345
|
782
|
+
)
|
783
|
+
```
|
784
|
+
|
785
|
+
#### `github_create_commit_comment_reaction`
|
786
|
+
Create a reaction for a commit comment.
|
787
|
+
|
788
|
+
```ruby
|
789
|
+
github_create_commit_comment_reaction(
|
790
|
+
api_token: "<your_github_token>",
|
791
|
+
repo_owner: "octocat",
|
792
|
+
repo_name: "Hello-World",
|
793
|
+
comment_id: 123456,
|
794
|
+
content: "heart" # Available reactions: +1, -1, laugh, confused, heart, hooray, rocket, eyes
|
795
|
+
)
|
796
|
+
```
|
797
|
+
|
798
|
+
#### `github_list_commit_comment_reactions`
|
799
|
+
List reactions for a commit comment.
|
800
|
+
|
801
|
+
```ruby
|
802
|
+
reactions = github_list_commit_comment_reactions(
|
803
|
+
api_token: "<your_github_token>",
|
804
|
+
repo_owner: "octocat",
|
805
|
+
repo_name: "Hello-World",
|
806
|
+
comment_id: 123456,
|
807
|
+
content: "heart" # Optional filter by reaction type
|
808
|
+
)
|
809
|
+
|
810
|
+
puts "Total reactions: #{reactions[:json].count}"
|
811
|
+
```
|
812
|
+
|
813
|
+
#### `github_delete_commit_comment_reaction`
|
814
|
+
Delete a reaction from a commit comment.
|
815
|
+
|
816
|
+
```ruby
|
817
|
+
github_delete_commit_comment_reaction(
|
818
|
+
api_token: "<your_github_token>",
|
819
|
+
repo_owner: "octocat",
|
820
|
+
repo_name: "Hello-World",
|
821
|
+
comment_id: 123456,
|
822
|
+
reaction_id: 12345
|
823
|
+
)
|
824
|
+
```
|