How to use the @actions/core.startGroup function in @actions/core

To help you get started, we’ve selected a few @actions/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cachix / cachix-action / src / main.ts View on Github external
const attributes = core.getInput('attributes');
    const name = core.getInput('name', { required: true });
    const signingKey = core.getInput('signingKey');
    const authToken = core.getInput('authToken')
    const cachixExecutable = "/nix/var/nix/profiles/per-user/runner/profile/bin/cachix";

    core.startGroup('Installing Cachix')
    await exec.exec('nix-env', ['-iA', 'cachix', '-f', 'https://cachix.org/api/v1/install']);
    core.endGroup()

    // for private caches
    if (authToken !== "") {
      await exec.exec(cachixExecutable, ['authtoken', authToken]);
    }

    core.startGroup(`Cachix: using ` + name);
    await exec.exec('cachix', ['use', name]);
    core.endGroup();

    if (signingKey !== "") {
      core.startGroup('Cachix: Configuring push');
      // needed to discover auth token
      await exec.exec("sudo", ["sh", "-c", `echo export HOME=${home()} > /etc/nix/cachix-push.sh`]);
      await exec.exec("sudo", ["sh", "-c", `echo export CACHIX_SIGNING_KEY=${signingKey} >> /etc/nix/cachix-push.sh`]);
      // needed to for nix-store
      await exec.exec("sudo", ["sh", "-c", `echo export PATH=\\$PATH:/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/per-user/runner/profile/bin >> /etc/nix/cachix-push.sh`]);
      await exec.exec("sudo", ["sh", "-c", `echo ${cachixExecutable} push ${name} \\$OUT_PATHS >> /etc/nix/cachix-push.sh`]);
      await exec.exec("sudo", ["sh", "-c", `chmod +x /etc/nix/cachix-push.sh`]);
      // enable post-build-hook
      await exec.exec("sudo", ["sh", "-c", `echo post-build-hook = /etc/nix/cachix-push.sh >> /etc/nix/nix.conf`]);
      core.exportVariable('CACHIX_SIGNING_KEY', signingKey);
github newrelic / newrelic-ruby-agent / .github / actions / build-ruby / index.js View on Github external
async function installDependencies(kind, dependencyList) {
  if (dependencyList === '') { return }
  core.startGroup(`Installing ${kind} dependencies`)

  core.info(`installing ${kind} dependencies ${dependencyList}`)

  // only update package list once per workflow invocation.
  if (!aptUpdated) {
    await exec.exec(`sudo apt-get update`)
    aptUpdated = true
  }
  await exec.exec(`sudo apt-get install -y --no-install-recommends ${dependencyList}`)

  core.endGroup()
}
github cachix / cachix-action / src / main.ts View on Github external
async function run() {
  try {
    // inputs
    const file = core.getInput('file');
    const skipNixBuild = core.getInput('skipNixBuild');
    const attributes = core.getInput('attributes');
    const name = core.getInput('name', { required: true });
    const signingKey = core.getInput('signingKey');
    const authToken = core.getInput('authToken')
    const cachixExecutable = "/nix/var/nix/profiles/per-user/runner/profile/bin/cachix";

    core.startGroup('Installing Cachix')
    await exec.exec('nix-env', ['-iA', 'cachix', '-f', 'https://cachix.org/api/v1/install']);
    core.endGroup()

    // for private caches
    if (authToken !== "") {
      await exec.exec(cachixExecutable, ['authtoken', authToken]);
    }

    core.startGroup(`Cachix: using ` + name);
    await exec.exec('cachix', ['use', name]);
    core.endGroup();

    if (signingKey !== "") {
      core.startGroup('Cachix: Configuring push');
      // needed to discover auth token
      await exec.exec("sudo", ["sh", "-c", `echo export HOME=${home()} > /etc/nix/cachix-push.sh`]);
github newrelic / newrelic-ruby-agent / .github / actions / build-ruby / index.js View on Github external
async function setupTestEnvironment(rubyVersion) {
  core.startGroup('Setup Test Environment')
  
  const filePath = gemspecFilePath(rubyVersion)
  const workspacePath = process.env.GITHUB_WORKSPACE

  await restoreBundleFromCache(rubyVersion)

  // restore the Gemfile.lock to working folder if cache-hit
  if (fs.existsSync(`${filePath}/Gemfile.lock`)) {
    await io.cp(`${filePath}/Gemfile.lock`, `${workspacePath}/Gemfile.lock`)
    await exec.exec('bundle', ['install'])
  }

  // otherwise, bundle install and cache it
  else {
    await exec.exec('bundle', ['install'])
    await io.cp(`${workspacePath}/Gemfile.lock`, `${filePath}/Gemfile.lock`)
github newrelic / newrelic-ruby-agent / .github / actions / build-ruby / index.js View on Github external
async function saveBundleToCache(rubyVersion) {
  core.startGroup(`Save Bundle to Cache`)

  const key = bundleCacheKey(rubyVersion)
  await cache.saveCache(bundleCachePaths(rubyVersion), key)
  
  core.endGroup()
}
github clupprich / ruby-build-action / src / index.js View on Github external
async function _installRubyBuild() {
  core.startGroup('Installing ruby-build')

  await _installDependencies()

  const rubyBuildDir = `${process.env.HOME}/var/ruby-build`
  await exec.exec(`git clone https://github.com/rbenv/ruby-build.git ${rubyBuildDir}`)
  await exec.exec(`sudo ${rubyBuildDir}/install.sh`, { env: { 'PREFIX': '/usr/local' } })

  core.endGroup()
}
github clupprich / ruby-build-action / src / index.js View on Github external
async function _installRuby(rubyVersion, cacheAvailable) {
  core.startGroup(`Installing ${rubyVersion}`)

  if (!cacheAvailable) {
    await exec.exec(`ruby-build ${rubyVersion} ${process.env.HOME}/local/rubies/${rubyVersion}`)
  } else {
    core.info(`Skipping installation of ${rubyVersion}, already available in cache.`)
  }

  core.addPath(`${process.env.HOME}/local/rubies/${rubyVersion}/bin`)
  const rubyPath = await io.which('ruby', true)
  await exec.exec(`${rubyPath} --version`)
  core.setOutput('ruby-path', rubyPath);

  core.endGroup()
}
github numworks / setup-msys2 / index.js View on Github external
'-C', dest.replace(/\\/g, '/'),
      '-f', distrib
    ]);

    let cmd = path.join(dest, 'msys2do.cmd');
    fs.writeFileSync(cmd, [
      'setlocal',
      'IF NOT DEFINED MSYS2_PATH_TYPE set MSYS2_PATH_TYPE=' + core.getInput('path-type'),
      `%~dp0\\msys64\\usr\\bin\\bash.exe -ilc "cd $OLDPWD && %*"`
    ].join('\r\n'));

    core.addPath(dest);

    core.exportVariable('MSYSTEM', core.getInput('msystem'));

    core.startGroup('Starting MSYS2 for the first time...');
      await exec.exec(`msys2do`, (core.getInput('update') == 'true') ?
        ['pacman', '-Syu', '--noconfirm']
        :
        ['uname', '-a']
      );
    core.endGroup();
  }
  catch (error) {
    core.setFailed(error.message);
  }
}
github newrelic / newrelic-ruby-agent / .github / actions / build-ruby / index.js View on Github external
async function restoreBundleFromCache(rubyVersion) {
  core.startGroup(`Restore Bundle from Cache`)
 
  const key = bundleCacheKey(rubyVersion)
  core.info(`restore using ${key}`)
  await cache.restoreCache(bundleCachePaths(rubyVersion), key, [key])
  
  core.endGroup()
}