generated from ubiquity/ts-template
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add payload creator for issue close event
Implemented getPayload function to streamline issue close event payload.
- Loading branch information
1 parent
93b33df
commit dfd04f5
Showing
6 changed files
with
280 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,240 @@ | ||
export function getPayload(ownerRepo: string, issueId: number, useOpenAi = false) { | ||
return { | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
body: JSON.stringify({ | ||
ref: "development", | ||
stateId: "1234", | ||
signature: "", | ||
eventName: "issues.closed", | ||
action: "closed", | ||
env: { | ||
SUPABASE_URL: "http://localhost:5432", | ||
SUPABASE__KEY: "1234", | ||
}, | ||
settings: { | ||
evmPrivateEncrypted: | ||
"YfEnpznMNbSPhCQzWy1Uevi4xQC25SqJrHd87CjjS1gsu92QrCReSgvl8Z_pVI1ZM57PNC1mZSgHbNgX9ITmOJc6qaOJ_mRe_sP_8jBcNimusDCQcWEkcPIW7Md-QGDPnwuN8FIavS7I0uiOIRYK6h0NK02-3uzPqhM", | ||
incentives: { | ||
userExtractor: {}, | ||
dataPurge: {}, | ||
formattingEvaluator: {}, | ||
contentEvaluator: { | ||
...(!useOpenAi && { | ||
openAi: { | ||
endpoint: "http://localhost:3000/openai", | ||
}, | ||
}), | ||
}, | ||
permitGeneration: null, | ||
githubComment: { | ||
post: true, | ||
debug: false, | ||
}, | ||
}, | ||
}, | ||
authToken: import.meta.env.VITE_GITHUB_TOKEN, | ||
eventPayload: { | ||
issue: { | ||
state_reason: "completed", | ||
url: `https://api.github.com/repos/${ownerRepo}/issues/${issueId}`, | ||
repository_url: `https://api.github.com/repos/${ownerRepo}`, | ||
labels_url: `https://api.github.com/repos/${ownerRepo}/issues/${issueId}/labels{/name}`, | ||
comments_url: `https://api.github.com/repos/${ownerRepo}/issues/${issueId}/comments`, | ||
events_url: `https://api.github.com/repos/${ownerRepo}/issues/${issueId}/events`, | ||
html_url: `https://github.com/${ownerRepo}/issues/${issueId}`, | ||
id: 1, | ||
node_id: "MDU6SXNzdWUx", | ||
number: issueId, | ||
title: "Found a bug", | ||
user: { | ||
login: "ubiquity-os", | ||
id: 1, | ||
node_id: "MDQ6VXNlcjE=", | ||
avatar_url: "https://github.com/images/error/ubiquity-os_happy.gif", | ||
gravatar_id: "", | ||
url: "https://api.github.com/users/ubiquity-os", | ||
html_url: "https://github.com/ubiquity-os", | ||
followers_url: "https://api.github.com/users/ubiquity-os/followers", | ||
following_url: "https://api.github.com/users/ubiquity-os/following{/other_user}", | ||
gists_url: "https://api.github.com/users/ubiquity-os/gists{/gist_id}", | ||
starred_url: "https://api.github.com/users/ubiquity-os/starred{/owner}{/repo}", | ||
subscriptions_url: "https://api.github.com/users/ubiquity-os/subscriptions", | ||
organizations_url: "https://api.github.com/users/ubiquity-os/orgs", | ||
repos_url: "https://api.github.com/users/ubiquity-os/repos", | ||
events_url: "https://api.github.com/users/ubiquity-os/events{/privacy}", | ||
received_events_url: "https://api.github.com/users/ubiquity-os/received_events", | ||
type: "User", | ||
site_admin: false, | ||
}, | ||
state: "closed", | ||
locked: false, | ||
assignee: { | ||
login: "ubiquity-os", | ||
id: 1, | ||
node_id: "MDQ6VXNlcjE=", | ||
avatar_url: "https://github.com/images/error/ubiquity-os_happy.gif", | ||
gravatar_id: "", | ||
url: "https://api.github.com/users/ubiquity-os", | ||
html_url: "https://github.com/ubiquity-os", | ||
followers_url: "https://api.github.com/users/ubiquity-os/followers", | ||
following_url: "https://api.github.com/users/ubiquity-os/following{/other_user}", | ||
gists_url: "https://api.github.com/users/ubiquity-os/gists{/gist_id}", | ||
starred_url: "https://api.github.com/users/ubiquity-os/starred{/owner}{/repo}", | ||
subscriptions_url: "https://api.github.com/users/ubiquity-os/subscriptions", | ||
organizations_url: "https://api.github.com/users/ubiquity-os/orgs", | ||
repos_url: "https://api.github.com/users/ubiquity-os/repos", | ||
events_url: "https://api.github.com/users/ubiquity-os/events{/privacy}", | ||
received_events_url: "https://api.github.com/users/ubiquity-os/received_events", | ||
type: "User", | ||
site_admin: false, | ||
}, | ||
labels: [ | ||
{ | ||
id: 208045946, | ||
node_id: "MDU6TGFiZWwyMDgwNDU5NDY=", | ||
url: `https://api.github.com/repos/${ownerRepo}/labels/bug`, | ||
name: "bug", | ||
description: "Something isn't working", | ||
color: "f29513", | ||
default: true, | ||
}, | ||
], | ||
comments: 0, | ||
created_at: "2011-04-22T13:33:48Z", | ||
updated_at: "2011-04-22T13:33:48Z", | ||
closed_at: "2011-04-22T13:33:48Z", | ||
author_association: "OWNER", | ||
body: "I'm having a problem with this.", | ||
}, | ||
repository: { | ||
id: 1296269, | ||
node_id: "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", | ||
name: "conversation-rewards", | ||
full_name: "ubiquity-os/conversation-rewards", | ||
owner: { | ||
login: "ubiquity-os", | ||
id: 159901852, | ||
node_id: "MDQ6VXNlcjE=", | ||
avatar_url: "https://github.com/images/error/ubiquity-os_happy.gif", | ||
gravatar_id: "", | ||
url: "https://api.github.com/users/ubiquity-os", | ||
html_url: "https://github.com/ubiquity-os", | ||
followers_url: "https://api.github.com/users/ubiquity-os/followers", | ||
following_url: "https://api.github.com/users/ubiquity-os/following{/other_user}", | ||
gists_url: "https://api.github.com/users/ubiquity-os/gists{/gist_id}", | ||
starred_url: "https://api.github.com/users/ubiquity-os/starred{/owner}{/repo}", | ||
subscriptions_url: "https://api.github.com/users/ubiquity-os/subscriptions", | ||
organizations_url: "https://api.github.com/users/ubiquity-os/orgs", | ||
repos_url: "https://api.github.com/users/ubiquity-os/repos", | ||
events_url: "https://api.github.com/users/ubiquity-os/events{/privacy}", | ||
received_events_url: "https://api.github.com/users/ubiquity-os/received_events", | ||
type: "User", | ||
site_admin: false, | ||
}, | ||
private: false, | ||
html_url: "https://github.com/ubiquity-os/conversation-rewards", | ||
description: "This your first repo!", | ||
fork: false, | ||
url: "https://api.github.com/repos/ubiquity-os/conversation-rewards", | ||
archive_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/{archive_format}{/ref}", | ||
assignees_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/assignees{/user}", | ||
blobs_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/git/blobs{/sha}", | ||
branches_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/branches{/branch}", | ||
collaborators_url: | ||
"https://api.github.com/repos/ubiquity-os/conversation-rewards/collaborators{/collaborator}", | ||
comments_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/comments{/number}", | ||
commits_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/commits{/sha}", | ||
compare_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/compare/{base}...{head}", | ||
contents_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/contents/{+path}", | ||
contributors_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/contributors", | ||
deployments_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/deployments", | ||
downloads_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/downloads", | ||
events_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/events", | ||
forks_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/forks", | ||
git_commits_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/git/commits{/sha}", | ||
git_refs_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/git/refs{/sha}", | ||
git_tags_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/git/tags{/sha}", | ||
git_url: "git:github.com/ubiquity-os/conversation-rewards.git", | ||
issue_comment_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/issues/comments{/number}", | ||
issue_events_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/issues/events{/number}", | ||
issues_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/issues{/number}", | ||
keys_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/keys{/key_id}", | ||
labels_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/labels{/name}", | ||
languages_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/languages", | ||
merges_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/merges", | ||
milestones_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/milestones{/number}", | ||
notifications_url: | ||
"https://api.github.com/repos/ubiquity-os/conversation-rewards/notifications{?since,all,participating}", | ||
pulls_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/pulls{/number}", | ||
releases_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/releases{/id}", | ||
stargazers_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/stargazers", | ||
statuses_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/statuses/{sha}", | ||
subscribers_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/subscribers", | ||
subscription_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/subscription", | ||
tags_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/tags", | ||
teams_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/teams", | ||
trees_url: "https://api.github.com/repos/ubiquity-os/conversation-rewards/git/trees{/sha}", | ||
homepage: "https://github.com", | ||
language: null, | ||
forks_count: 9, | ||
stargazers_count: 80, | ||
watchers_count: 80, | ||
size: 108, | ||
default_branch: "master", | ||
open_issues_count: 0, | ||
is_template: false, | ||
topics: [], | ||
has_issues: true, | ||
has_projects: true, | ||
has_wiki: true, | ||
has_pages: false, | ||
has_downloads: true, | ||
archived: false, | ||
disabled: false, | ||
visibility: "public", | ||
pushed_at: "2011-01-26T19:06:43Z", | ||
created_at: "2011-01-26T19:01:12Z", | ||
updated_at: "2011-01-26T19:14:43Z", | ||
permissions: { | ||
admin: false, | ||
maintain: false, | ||
push: false, | ||
triage: false, | ||
pull: true, | ||
}, | ||
allow_rebase_merge: true, | ||
temp_clone_token: "", | ||
allow_squash_merge: true, | ||
allow_auto_merge: false, | ||
delete_branch_on_merge: true, | ||
allow_merge_commit: true, | ||
subscribers_count: 42, | ||
network_count: 0, | ||
}, | ||
sender: { | ||
login: "ubiquity-os", | ||
id: 159901852, | ||
node_id: "MDQ6VXNlcjE=", | ||
avatar_url: "https://github.com/images/error/ubiquity-os_happy.gif", | ||
gravatar_id: "", | ||
url: "https://api.github.com/users/ubiquity-os", | ||
html_url: "https://github.com/ubiquity-os", | ||
followers_url: "https://api.github.com/users/ubiquity-os/followers", | ||
following_url: "https://api.github.com/users/ubiquity-os/following{/other_user}", | ||
gists_url: "https://api.github.com/users/ubiquity-os/gists{/gist_id}", | ||
starred_url: "https://api.github.com/users/ubiquity-os/starred{/owner}{/repo}", | ||
subscriptions_url: "https://api.github.com/users/ubiquity-os/subscriptions", | ||
organizations_url: "https://api.github.com/users/ubiquity-os/orgs", | ||
repos_url: "https://api.github.com/users/ubiquity-os/repos", | ||
events_url: "https://api.github.com/users/ubiquity-os/events{/privacy}", | ||
received_events_url: "https://api.github.com/users/ubiquity-os/received_events", | ||
type: "User", | ||
site_admin: false, | ||
}, | ||
}, | ||
}), | ||
}; | ||
} |
Oops, something went wrong.