tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

build_daily_comment.mjs (1066B)


      1 /**
      2 * @license
      3 * Copyright 2024 Google Inc.
      4 * SPDX-License-Identifier: Apache-2.0
      5 */
      6 import actions from '@actions/core';
      7 
      8 /**
      9 *
     10 * @param {string} env
     11 * @returns {string}
     12 */
     13 function getGitHubEnvVariable(env) {
     14  return process.env[`GITHUB_${env.toUpperCase()}`];
     15 }
     16 
     17 function getStatus(result) {
     18  if (result === 'success') {
     19    return '✅ Tests succeeded';
     20  }
     21 
     22  return '❌ Tests failed';
     23 }
     24 
     25 const options = {
     26  year: 'numeric',
     27  month: 'numeric',
     28  day: 'numeric',
     29 };
     30 const today = new Date().toLocaleDateString('en-GB', options);
     31 
     32 const chromeStatus = getStatus(process.env.CHROME_RUN_STATUS);
     33 const firefoxStatus = getStatus(process.env.FIREFOX_RUN_STATUS);
     34 const body = `
     35 Date: ${today}
     36 
     37 | Browser | Status | 
     38 | ------- | ------ | 
     39 | Chrome Canary | ${chromeStatus} |
     40 | Firefox Nightly | ${firefoxStatus} |
     41 `;
     42 
     43 const footer = `
     44 ---
     45 [Link](${getGitHubEnvVariable('server_url')}/${getGitHubEnvVariable('repository')}/actions/runs/${getGitHubEnvVariable('run_id')})`;
     46 
     47 actions.setOutput('today', today);
     48 actions.setOutput('body', `${body}${footer}`);