Connect a Git repository to a Pages site
import requests
url = "https://platform.ankra.app/api/v1/org/pages/sites/{site_name}/git"
payload = {
"repository_owner": "<string>",
"repository_name": "<string>",
"production_branch": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
repository_owner: '<string>',
repository_name: '<string>',
production_branch: '<string>'
})
};
fetch('https://platform.ankra.app/api/v1/org/pages/sites/{site_name}/git', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PUT \
--url https://platform.ankra.app/api/v1/org/pages/sites/{site_name}/git \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"repository_owner": "<string>",
"repository_name": "<string>",
"production_branch": "<string>"
}
'{
"site_name": "<string>",
"provider": "github",
"repository_owner": "<string>",
"repository_name": "<string>",
"production_branch": "<string>",
"root_directory": "<string>",
"previews": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason": "<string>",
"code": "<string>",
"message": "<string>",
"missing_sha256": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason": "<string>",
"code": "<string>",
"message": "<string>",
"missing_sha256": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason": "<string>",
"code": "<string>",
"message": "<string>",
"missing_sha256": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason": "<string>",
"code": "<string>",
"message": "<string>",
"missing_sha256": [
"<string>"
]
}Pages
Connect a Git repository to a Pages site
Connects a GitHub repository to the site, or changes the one it has. A push to the production branch deploys the production alias; while previews are on, a push to another branch deploys the alias named after the branch, and a pull request from the same repository deploys pr-<number> and gets a comment with its address. Pull requests from forks are never deployed. The site is the commit's files under the root directory, nothing is built, and every deploy runs as the caller, only while the caller may still deploy in the site's project. The Ankra GitHub App must be installed on the repository. Needs applications.deploy.
PUT
/
api
/
v1
/
org
/
pages
/
sites
/
{site_name}
/
git
Connect a Git repository to a Pages site
import requests
url = "https://platform.ankra.app/api/v1/org/pages/sites/{site_name}/git"
payload = {
"repository_owner": "<string>",
"repository_name": "<string>",
"production_branch": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
repository_owner: '<string>',
repository_name: '<string>',
production_branch: '<string>'
})
};
fetch('https://platform.ankra.app/api/v1/org/pages/sites/{site_name}/git', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PUT \
--url https://platform.ankra.app/api/v1/org/pages/sites/{site_name}/git \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"repository_owner": "<string>",
"repository_name": "<string>",
"production_branch": "<string>"
}
'{
"site_name": "<string>",
"provider": "github",
"repository_owner": "<string>",
"repository_name": "<string>",
"production_branch": "<string>",
"root_directory": "<string>",
"previews": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason": "<string>",
"code": "<string>",
"message": "<string>",
"missing_sha256": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason": "<string>",
"code": "<string>",
"message": "<string>",
"missing_sha256": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason": "<string>",
"code": "<string>",
"message": "<string>",
"missing_sha256": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason": "<string>",
"code": "<string>",
"message": "<string>",
"missing_sha256": [
"<string>"
]
}Authorizations
Body
application/json
Response
The repository is connected: pushes to it deploy the site.
The GitHub repository a site deploys from.