All Collections
Insights
Deployment Frequency
Set up Deployment Frequency with GitHub environments
Set up Deployment Frequency with GitHub environments
Tam Pham avatar
Written by Tam Pham
Updated over a week ago

The deployment frequency page is directly tied to Github Environments. When a deployment is made to the environment in the repo, the deployment frequency page is also updated.

Environments can be created in your Github repo settings. Deployments to these environments are done using Github Actions or by using the Github API. Updating the status of these environments informs Insights that a build was successfully deployed.

However, if you deploy somewhere else, you can still update this status using the Github API. All you need to do is hit the endpoint for updating statuses after a build is successfully deployed. Simply running a script after successful deployment will accomplish this.

An example using cURL and JS exists in the docs. Here is the one for JS

// Octokit.js

// https://github.com/octokit/core.js#readme

const octokit = new Octokit({

auth: 'YOUR-TOKEN'

})

await octokit.request('POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses', {

owner: 'OWNER',

repo: 'REPO',

deployment_id: 'DEPLOYMENT_ID',

environment: 'production',

state: 'success',

log_url: 'https://example.com/deployment/42/output',

description: 'Deployment finished successfully.',

headers: {

'X-GitHub-Api-Version': '2022-11-28'

}

})

Did this answer your question?