curl --request POST \
--url https://patch.gg/api/v1/github/connect \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"repo_id": 123,
"owner": "<string>",
"slug": "<string>",
"name": "<string>",
"project": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
repo_id: 123,
owner: '<string>',
slug: '<string>',
name: '<string>',
project: '<string>'
})
};
fetch('https://patch.gg/api/v1/github/connect', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://patch.gg/api/v1/github/connect"
payload = {
"repo_id": 123,
"owner": "<string>",
"slug": "<string>",
"name": "<string>",
"project": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"project": {
"owner": "<string>",
"slug": "<string>"
},
"github": {
"repo_id": 123,
"full_name": "sam/sky-mod",
"html_url": "https://github.com/sam/sky-mod",
"default_branch": "main",
"private": true,
"head_commit": "<string>",
"pushed_at": "2023-11-07T05:31:56Z",
"state": "connected"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}Connect a GitHub repo to a project
Its home becomes GitHub: Patch records it by GitHub’s id and copies none of its files. It goes to a new project of owner’s (an org you’re in; slug and name from the repo unless you say), or to project (owner/slug), one of your orgs’ with no repo yet (409 has_repo). You need admin or maintain on it on GitHub (403 github_not_admin), and the app installed on its account (403 github_not_installed, with install_url) and reaching it (403 github_repo_not_added, with settings_url). One project per repo (409 already_connected, saying where to whoever can see it). The project takes the repo’s licence for its code and art, new or existing: GitHub’s SPDX id for it, NOASSERTION for one GitHub can’t name, or LicenseRef-Proprietary (all rights reserved) with none. A public repo with a licence starts Open, and any other Private; an existing Open project stays Open only if the repo can be, and otherwise goes Closed source if people play a release of it, or Private. A chat’s key leaves it as a chat’s first push would: a new project starts Private, and an existing Open one stays Open only where the person chose Open and the repo can be, going Closed source otherwise if people play a release of it, or Private. Only a public repo can be Open (422 needs_public), only one with a licence of its own until the Patch licence is ready (422 needs_license), and only the person can make it Open, not a chat’s key (403 open_needs_person, with page, where they can: the project’s page, or a new project’s once it’s connected). Its first commits are recorded as best GitHub says. A public repo’s README and top-level names are read for its page once it’s connected, or by the hourly job when GitHub doesn’t give them then; a private repo’s never are. Needs the publish scope. Send an Idempotency-Key header to make retries safe.
curl --request POST \
--url https://patch.gg/api/v1/github/connect \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"repo_id": 123,
"owner": "<string>",
"slug": "<string>",
"name": "<string>",
"project": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
repo_id: 123,
owner: '<string>',
slug: '<string>',
name: '<string>',
project: '<string>'
})
};
fetch('https://patch.gg/api/v1/github/connect', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://patch.gg/api/v1/github/connect"
payload = {
"repo_id": 123,
"owner": "<string>",
"slug": "<string>",
"name": "<string>",
"project": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"project": {
"owner": "<string>",
"slug": "<string>"
},
"github": {
"repo_id": 123,
"full_name": "sam/sky-mod",
"html_url": "https://github.com/sam/sky-mod",
"default_branch": "main",
"private": true,
"head_commit": "<string>",
"pushed_at": "2023-11-07T05:31:56Z",
"state": "connected"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}Authorizations
An API key (pch_...) or the token from pch login.
Body
GitHub's id
The org a new project goes to; needed unless project says
1 - 1001 - 641 - 100Who can reach the project's repo. open: anyone can find it, read it and fork it. closed_source: anyone can find and play what it releases; only its org reads the source. private: only its org can find it, and anyone else gets a 404. It isn't locked: the game host serves a published browser game to anyone who has its address.
open, closed_source, private An existing project with no repo, as owner/slug
^[^/\s]+\/[^/\s]+$