@loopstack/github-oauth-example 0.1.1 → 0.2.1
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.
- package/README.md +116 -20
- package/dist/tools/authenticate-github-task.tool.d.ts +9 -8
- package/dist/tools/authenticate-github-task.tool.d.ts.map +1 -1
- package/dist/tools/authenticate-github-task.tool.js +30 -62
- package/dist/tools/authenticate-github-task.tool.js.map +1 -1
- package/dist/workflows/github-agent.ui.yaml +16 -0
- package/dist/workflows/github-agent.workflow.d.ts +14 -13
- package/dist/workflows/github-agent.workflow.d.ts.map +1 -1
- package/dist/workflows/github-agent.workflow.js +155 -71
- package/dist/workflows/github-agent.workflow.js.map +1 -1
- package/dist/workflows/github-repos-overview.ui.yaml +17 -0
- package/dist/workflows/github-repos-overview.workflow.d.ts +77 -87
- package/dist/workflows/github-repos-overview.workflow.d.ts.map +1 -1
- package/dist/workflows/github-repos-overview.workflow.js +177 -228
- package/dist/workflows/github-repos-overview.workflow.js.map +1 -1
- package/dist/workflows/templates/repoOverview.md +81 -0
- package/dist/workflows/templates/systemMessage.md +23 -0
- package/package.json +7 -7
- package/src/tools/authenticate-github-task.tool.ts +34 -82
- package/src/workflows/__tests__/github-repos-overview-workflow.spec.ts +105 -249
- package/src/workflows/github-agent.ui.yaml +16 -0
- package/src/workflows/github-agent.workflow.ts +109 -27
- package/src/workflows/github-repos-overview.ui.yaml +17 -0
- package/src/workflows/github-repos-overview.workflow.ts +257 -215
- package/src/workflows/templates/repoOverview.md +81 -0
- package/src/workflows/templates/systemMessage.md +23 -0
- package/dist/workflows/github-agent.workflow.yaml +0 -154
- package/dist/workflows/github-repos-overview.workflow.yaml +0 -249
- package/src/workflows/github-agent.workflow.yaml +0 -154
- package/src/workflows/github-repos-overview.workflow.yaml +0 -249
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
title: 'GitHub Repository Overview'
|
|
2
|
-
|
|
3
|
-
description: |
|
|
4
|
-
Comprehensive GitHub example that exercises every GitHub tool.
|
|
5
|
-
Fetches user info, repository details, issues, pull requests, branches,
|
|
6
|
-
directory contents, workflow runs, and search results for a given repository.
|
|
7
|
-
If not authenticated, launches the OAuth sub-workflow and retries.
|
|
8
|
-
|
|
9
|
-
ui:
|
|
10
|
-
form:
|
|
11
|
-
properties:
|
|
12
|
-
owner:
|
|
13
|
-
title: 'Repository Owner'
|
|
14
|
-
placeholder: 'octocat'
|
|
15
|
-
repo:
|
|
16
|
-
title: 'Repository Name'
|
|
17
|
-
placeholder: 'Hello-World'
|
|
18
|
-
|
|
19
|
-
transitions:
|
|
20
|
-
# Step 1: Fetch authenticated user and orgs
|
|
21
|
-
- id: fetch_user
|
|
22
|
-
from: start
|
|
23
|
-
to: user_fetched
|
|
24
|
-
call:
|
|
25
|
-
- tool: gitHubGetAuthenticatedUser
|
|
26
|
-
id: user_fetch
|
|
27
|
-
args: {}
|
|
28
|
-
assign:
|
|
29
|
-
requiresAuthentication: ${{ result.data.error == "unauthorized" }}
|
|
30
|
-
user: ${{ result.data.user }}
|
|
31
|
-
|
|
32
|
-
# If unauthorized -> launch OAuth
|
|
33
|
-
- id: auth_required
|
|
34
|
-
from: user_fetched
|
|
35
|
-
to: awaiting_auth
|
|
36
|
-
if: ${{ state.requiresAuthentication }}
|
|
37
|
-
call:
|
|
38
|
-
- tool: task
|
|
39
|
-
id: launchAuth
|
|
40
|
-
args:
|
|
41
|
-
workflow: oAuth
|
|
42
|
-
args:
|
|
43
|
-
provider: 'github'
|
|
44
|
-
scopes:
|
|
45
|
-
- 'repo'
|
|
46
|
-
- 'read:org'
|
|
47
|
-
- 'workflow'
|
|
48
|
-
callback:
|
|
49
|
-
transition: auth_completed
|
|
50
|
-
|
|
51
|
-
- tool: createDocument
|
|
52
|
-
args:
|
|
53
|
-
id: authStatus
|
|
54
|
-
document: linkDocument
|
|
55
|
-
update:
|
|
56
|
-
content:
|
|
57
|
-
icon: 'LockKeyhole'
|
|
58
|
-
label: 'GitHub authentication required'
|
|
59
|
-
caption: 'Complete sign-in to continue'
|
|
60
|
-
href: '/pipelines/{{ runtime.tools.auth_required.launchAuth.data.pipelineId }}'
|
|
61
|
-
embed: true
|
|
62
|
-
expanded: true
|
|
63
|
-
|
|
64
|
-
# Auth completed -> retry from start
|
|
65
|
-
- id: auth_completed
|
|
66
|
-
from: awaiting_auth
|
|
67
|
-
to: start
|
|
68
|
-
trigger: manual
|
|
69
|
-
call:
|
|
70
|
-
- tool: createDocument
|
|
71
|
-
args:
|
|
72
|
-
id: authStatus
|
|
73
|
-
document: linkDocument
|
|
74
|
-
update:
|
|
75
|
-
content:
|
|
76
|
-
icon: 'ShieldCheck'
|
|
77
|
-
type: 'success'
|
|
78
|
-
label: 'GitHub authentication completed'
|
|
79
|
-
caption: 'You are now authenticated with GitHub.'
|
|
80
|
-
href: '/pipelines/{{ runtime.transition.payload.pipelineId }}'
|
|
81
|
-
|
|
82
|
-
# Step 2: Fetch user orgs
|
|
83
|
-
- id: fetch_orgs
|
|
84
|
-
from: user_fetched
|
|
85
|
-
to: orgs_fetched
|
|
86
|
-
call:
|
|
87
|
-
- tool: gitHubListUserOrgs
|
|
88
|
-
id: orgs_fetch
|
|
89
|
-
args:
|
|
90
|
-
perPage: 10
|
|
91
|
-
assign:
|
|
92
|
-
orgs: ${{ result.data.orgs }}
|
|
93
|
-
|
|
94
|
-
# Step 3: Fetch repo details and branches
|
|
95
|
-
- id: fetch_repo_details
|
|
96
|
-
from: orgs_fetched
|
|
97
|
-
to: repo_fetched
|
|
98
|
-
call:
|
|
99
|
-
- tool: gitHubGetRepo
|
|
100
|
-
id: repo_fetch
|
|
101
|
-
args:
|
|
102
|
-
owner: ${{ args.owner }}
|
|
103
|
-
repo: ${{ args.repo }}
|
|
104
|
-
assign:
|
|
105
|
-
repo: ${{ result.data.repo }}
|
|
106
|
-
|
|
107
|
-
- tool: gitHubListBranches
|
|
108
|
-
id: branches_fetch
|
|
109
|
-
args:
|
|
110
|
-
owner: ${{ args.owner }}
|
|
111
|
-
repo: ${{ args.repo }}
|
|
112
|
-
assign:
|
|
113
|
-
branches: ${{ result.data.branches }}
|
|
114
|
-
|
|
115
|
-
# Step 4: Fetch issues and PRs
|
|
116
|
-
- id: fetch_issues_prs
|
|
117
|
-
from: repo_fetched
|
|
118
|
-
to: issues_prs_fetched
|
|
119
|
-
call:
|
|
120
|
-
- tool: gitHubListIssues
|
|
121
|
-
id: issues_fetch
|
|
122
|
-
args:
|
|
123
|
-
owner: ${{ args.owner }}
|
|
124
|
-
repo: ${{ args.repo }}
|
|
125
|
-
state: 'open'
|
|
126
|
-
perPage: 10
|
|
127
|
-
assign:
|
|
128
|
-
issues: ${{ result.data.issues }}
|
|
129
|
-
|
|
130
|
-
- tool: gitHubListPullRequests
|
|
131
|
-
id: prs_fetch
|
|
132
|
-
args:
|
|
133
|
-
owner: ${{ args.owner }}
|
|
134
|
-
repo: ${{ args.repo }}
|
|
135
|
-
state: 'open'
|
|
136
|
-
perPage: 10
|
|
137
|
-
assign:
|
|
138
|
-
pullRequests: ${{ result.data.pullRequests }}
|
|
139
|
-
|
|
140
|
-
# Step 5: Fetch directory listing and workflow runs
|
|
141
|
-
- id: fetch_content_actions
|
|
142
|
-
from: issues_prs_fetched
|
|
143
|
-
to: content_actions_fetched
|
|
144
|
-
call:
|
|
145
|
-
- tool: gitHubListDirectory
|
|
146
|
-
id: dir_fetch
|
|
147
|
-
args:
|
|
148
|
-
owner: ${{ args.owner }}
|
|
149
|
-
repo: ${{ args.repo }}
|
|
150
|
-
assign:
|
|
151
|
-
directoryEntries: ${{ result.data.entries }}
|
|
152
|
-
|
|
153
|
-
- tool: gitHubListWorkflowRuns
|
|
154
|
-
id: runs_fetch
|
|
155
|
-
args:
|
|
156
|
-
owner: ${{ args.owner }}
|
|
157
|
-
repo: ${{ args.repo }}
|
|
158
|
-
perPage: 5
|
|
159
|
-
assign:
|
|
160
|
-
workflowRuns: ${{ result.data.runs }}
|
|
161
|
-
|
|
162
|
-
# Step 6: Search code in the repo
|
|
163
|
-
- id: fetch_search
|
|
164
|
-
from: content_actions_fetched
|
|
165
|
-
to: search_done
|
|
166
|
-
call:
|
|
167
|
-
- tool: gitHubSearchCode
|
|
168
|
-
id: code_search
|
|
169
|
-
args:
|
|
170
|
-
query: ${{ searchQuery() }}
|
|
171
|
-
perPage: 5
|
|
172
|
-
assign:
|
|
173
|
-
searchResults: ${{ result.data.results }}
|
|
174
|
-
|
|
175
|
-
# Display all results
|
|
176
|
-
- id: display_results
|
|
177
|
-
from: search_done
|
|
178
|
-
to: end
|
|
179
|
-
call:
|
|
180
|
-
- tool: createDocument
|
|
181
|
-
args:
|
|
182
|
-
document: markdown
|
|
183
|
-
update:
|
|
184
|
-
content:
|
|
185
|
-
markdown: |
|
|
186
|
-
## Authenticated User
|
|
187
|
-
**{{ state.user.login }}** {{#if state.user.name}}({{ state.user.name }}){{/if}} — {{ state.user.publicRepos }} public repos
|
|
188
|
-
|
|
189
|
-
{{#if state.orgs}}
|
|
190
|
-
### Organizations
|
|
191
|
-
{{#each state.orgs}}
|
|
192
|
-
- **{{ this.login }}** {{#if this.description}}— {{ this.description }}{{/if}}
|
|
193
|
-
{{/each}}
|
|
194
|
-
{{/if}}
|
|
195
|
-
|
|
196
|
-
---
|
|
197
|
-
|
|
198
|
-
## Repository: [{{ state.repo.fullName }}]({{ state.repo.htmlUrl }})
|
|
199
|
-
{{ state.repo.description }}
|
|
200
|
-
|
|
201
|
-
| Language | Stars | Forks | Open Issues | Default Branch |
|
|
202
|
-
|---|---|---|---|---|
|
|
203
|
-
| {{ state.repo.language }} | {{ state.repo.stars }} | {{ state.repo.forks }} | {{ state.repo.openIssues }} | {{ state.repo.defaultBranch }} |
|
|
204
|
-
|
|
205
|
-
### Branches
|
|
206
|
-
{{#each state.branches}}
|
|
207
|
-
- `{{ this.name }}` {{#if this.protected}}(protected){{/if}}
|
|
208
|
-
{{/each}}
|
|
209
|
-
|
|
210
|
-
---
|
|
211
|
-
|
|
212
|
-
### Open Issues
|
|
213
|
-
{{#each state.issues}}
|
|
214
|
-
- [#{{ this.number }}]({{ this.htmlUrl }}) {{ this.title }} — @{{ this.user }}
|
|
215
|
-
{{/each}}
|
|
216
|
-
{{#unless state.issues}}
|
|
217
|
-
No open issues.
|
|
218
|
-
{{/unless}}
|
|
219
|
-
|
|
220
|
-
### Open Pull Requests
|
|
221
|
-
{{#each state.pullRequests}}
|
|
222
|
-
- [#{{ this.number }}]({{ this.htmlUrl }}) {{ this.title }} — @{{ this.user }} {{#if this.draft}}(draft){{/if}}
|
|
223
|
-
{{/each}}
|
|
224
|
-
{{#unless state.pullRequests}}
|
|
225
|
-
No open pull requests.
|
|
226
|
-
{{/unless}}
|
|
227
|
-
|
|
228
|
-
---
|
|
229
|
-
|
|
230
|
-
### Root Directory
|
|
231
|
-
{{#each state.directoryEntries}}
|
|
232
|
-
- {{ this.type }} `{{ this.name }}`
|
|
233
|
-
{{/each}}
|
|
234
|
-
|
|
235
|
-
### Recent Workflow Runs
|
|
236
|
-
{{#each state.workflowRuns}}
|
|
237
|
-
- [{{ this.name }}]({{ this.htmlUrl }}) — {{ this.status }} {{#if this.conclusion}}({{ this.conclusion }}){{/if}}
|
|
238
|
-
{{/each}}
|
|
239
|
-
{{#unless state.workflowRuns}}
|
|
240
|
-
No workflow runs found.
|
|
241
|
-
{{/unless}}
|
|
242
|
-
|
|
243
|
-
### Code Search Results
|
|
244
|
-
{{#each state.searchResults}}
|
|
245
|
-
- `{{ this.path }}` in {{ this.repository }}
|
|
246
|
-
{{/each}}
|
|
247
|
-
{{#unless state.searchResults}}
|
|
248
|
-
No code search results.
|
|
249
|
-
{{/unless}}
|