Github: Show deployed service URLs
How does this help you?​
- Quickly access the staging and production URLs for repositories
Preview​
How it looks in the extension
Deployed URLs
High level approach​
There are two common ways to map a repository to its deployed URLs:
- Data file (simple): Keep a small mapping file alongside your integrations that lists, for each repo, the staging and production URLs. This is easy to start with and version‑controlled.
- Service catalog (scalable): Query your source of truth (e.g., Backstage, Datadog Service Catalog) to resolve environment endpoints dynamically. This is preferable when you already maintain a catalog.
Below, we implement approach number 1 (the simple data file approach) and render a dropdown with links to staging and production.
Example data file (deployed-urls.data.json)​
{
"mappings": {
"company/webshop": {
"production": "https://webshop.company.com",
"staging": "https://staging.webshop.company.com"
},
"company/notifier": {
"production": "https://notifier.company.com",
"staging": "https://staging.notifier.company.com"
}
}
}
Prerequisites​
No external auth required. Add the data file (e.g., deployed-urls.data.json) to your data directory in your Github repository. Learn more about data files in Data.
Code​
github.deployed-urls.integration.example.js
module.exports = {
metadata: {
name: 'github-show-deployed-service-urls',
description: 'Show staging and production URLs for this repository as a dropdown, using a data file mapping',
match: {
contextType: 'github',
context: {
'page.repository': { startsWith: 'my-org/' }
}
},
requiredSecrets: [],
cache: 300
},
run: async function (context, secrets = {}, dataFiles = []) {
const repo = context.page.repository; // e.g., "company/webshop"
// Expect a data file like deployed-urls.data.json with shape:
// { "mappings": { "org/repo": { "production": "https://...", "staging": "https://..." } } }
const df = dataFiles.find(f => f.id === 'deployed-urls');
if (!df || !df.data) {
return [];
}
const mappings = df.data.mappings || {};
const envs = mappings[repo];
if (!envs || (typeof envs !== 'object')) {
return [];
}
const items = [];
if (envs.production) {
items.push({ content: 'Production', href: envs.production, status: 'important', icon: 'link' });
}
if (envs.staging) {
items.push({ content: 'Staging', href: envs.staging, icon: 'link' });
}
if (items.length === 0) {
return [];
}
return [
{
type: 'dropdown',
content: 'Deployed URLs',
items
}
];
}
};