@grafana/data#PluginBuildInfo TypeScript Examples
The following examples show how to use
@grafana/data#PluginBuildInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: env.ts From grafana-chinese with Apache License 2.0 | 6 votes |
getPluginBuildInfo = async (): Promise<PluginBuildInfo> => {
if (process.env.CIRCLE_SHA1) {
const info: PluginBuildInfo = {
time: Date.now(),
repo: process.env.CIRCLE_REPOSITORY_URL,
branch: process.env.CIRCLE_BRANCH,
hash: process.env.CIRCLE_SHA1,
};
const pr = getPullRequestNumber();
const build = getBuildNumber();
if (pr) {
info.pr = pr;
}
if (build) {
info.number = build;
}
return Promise.resolve(info);
}
const branch = await execa('git', ['rev-parse', '--abbrev-ref', 'HEAD']);
const hash = await execa('git', ['rev-parse', 'HEAD']);
return {
time: Date.now(),
branch: branch.stdout,
hash: hash.stdout,
};
}