react/scripts/release/shared-commands/get-latest-master-build-number.js
Brian Vaughn 95056b6836
DevTools build script enhancements (#17653)
* Updated DevTools local development instructions to mention experimental build step

* Added a command to download latest experimental release (for DevTools)

* Updated build instructions for clarity

* Added build-for-devtools package alias
2019-12-18 14:34:40 -08:00

32 lines
841 B
JavaScript

#!/usr/bin/env node
'use strict';
const http = require('request-promise-json');
const {logPromise} = require('../utils');
const run = async useExperimentalBuild => {
const targetJobName = useExperimentalBuild
? 'process_artifacts_experimental'
: 'process_artifacts';
// https://circleci.com/docs/api/#recent-builds-for-a-project-branch
const metadataURL = `https://circleci.com/api/v1.1/project/github/facebook/react/tree/master`;
const metadata = await http.get(metadataURL, true);
const build = metadata.find(
entry =>
entry.branch === 'master' &&
entry.status === 'success' &&
entry.workflows.job_name === targetJobName
).build_num;
return build;
};
module.exports = async params => {
return logPromise(
run(params),
'Determining latest Circle CI for the master branch'
);
};