renovate/tools/dispatch-release.mjs
renovate[bot] 4f59b62da4
chore(deps): update dependency prettier to v2 (#5952)
* chore(deps): update dependency prettier to v2

* Run prettier-fix

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Jamie Magee <jamie.magee@gmail.com>
2020-04-12 18:09:36 +02:00

38 lines
913 B
JavaScript

import got from 'got';
import shell from 'shelljs';
import { program } from './utils.mjs';
const version = program.release;
const dry = program.dryRun;
const baseUrl = 'https://api.github.com/';
shell.echo(`Dispatching version: ${version}`);
(async () => {
if (dry) {
shell.echo('DRY-RUN: done.');
return;
}
await got(`repos/${process.env.GITHUB_REPOSITORY}/dispatches`, {
baseUrl,
headers: {
'user-agent': 'Renovate release helper',
authorization: `token ${process.env.GITHUB_TOKEN}`,
},
json: true,
retry: 5,
body: {
event_type: 'renovate-release',
// max 10 keys here, https://github.com/peter-evans/repository-dispatch#client-payload
client_payload: {
sha: process.env.GITHUB_SHA,
ref: process.env.GITHUB_REF,
version,
},
},
});
})().catch((e) => {
// Ignore for now
shell.echo(e.toString());
});