1. /**
    
  2.  * Copyright (c) Meta Platforms, Inc. and affiliates.
    
  3.  *
    
  4.  * This source code is licensed under the MIT license found in the
    
  5.  * LICENSE file in the root directory of this source tree.
    
  6.  */
    
  7. 
    
  8. 'use strict';
    
  9. 
    
  10. const path = require('path');
    
  11. const spawn = require('child_process').spawn;
    
  12. 
    
  13. const extension = process.platform === 'win32' ? '.cmd' : '';
    
  14. 
    
  15. // sizebot public_repo token (this is publicly visible on purpose)
    
  16. const token = 'ghp_UfuUaoow8veN3ZV1' + 'sGquTDgiVjRDmL2qLY1D';
    
  17. spawn(
    
  18.   path.join('node_modules', '.bin', 'danger-ci' + extension),
    
  19.   [
    
  20.     '--id',
    
  21.     process.env.RELEASE_CHANNEL === 'experimental' ? 'experimental' : 'stable',
    
  22.   ],
    
  23.   {
    
  24.     // Allow colors to pass through
    
  25.     stdio: 'inherit',
    
  26.     env: {
    
  27.       ...process.env,
    
  28.       DANGER_GITHUB_API_TOKEN: token,
    
  29.     },
    
  30.   }
    
  31. ).on('close', function (code) {
    
  32.   if (code !== 0) {
    
  33.     console.error('Danger failed');
    
  34.   } else {
    
  35.     console.log('Danger passed');
    
  36.   }
    
  37. 
    
  38.   process.exit(code);
    
  39. });