How to use the @actions/core.info 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 peter-evans / slash-command-dispatch / src / index.js View on Github external
commentWords,
        cmd.named_args
      );
      core.debug(
        `Slash command payload: ${inspect(clientPayload.slash_command)}`
      );
      // Dispatch the command
      const dispatchRepo = cmd.repository.split("/");
      const eventType = cmd.command + cmd.event_type_suffix;
      await octokit.repos.createDispatchEvent({
        owner: dispatchRepo[0],
        repo: dispatchRepo[1],
        event_type: eventType,
        client_payload: clientPayload
      });
      core.info(
        `Command '${cmd.command}' dispatched to '${cmd.repository}' ` +
          `with event type '${eventType}'.`
      );
    }

    // Add the "rocket" reaction to the comment
    if (inputs.reactions)
      await addReaction(
        reactionOctokit,
        github.context.repo,
        commentId,
        "rocket"
      );
  } catch (error) {
    core.debug(inspect(error));
    core.setFailed(error.message);
github peter-evans / slash-command-dispatch / src / index.js View on Github external
if (commentBody.charAt(0) != "/" || commentBody.length < 2) {
      core.info("Comment is not a valid slash command.");
      return;
    }

    // Split the comment into "words"
    const commentWords = commentBody.slice(1).split(" ");
    core.debug(`Comment words: ${inspect(commentWords)}`);

    // Check if the command is registered for dispatch
    var configMatches = config.filter(function(cmd) {
      return cmd.command == commentWords[0];
    });
    core.debug(`Config matches on 'command': ${inspect(configMatches)}`);
    if (configMatches.length == 0) {
      core.info(`Command '${commentWords[0]}' is not registered for dispatch.`);
      return;
    }

    // Filter matching commands by issue type
    const isPullRequest = "pull_request" in github.context.payload.issue;
    configMatches = configMatches.filter(function(cmd) {
      return (
        cmd.issue_type == "both" ||
        (cmd.issue_type == "issue" && !isPullRequest) ||
        (cmd.issue_type == "pull-request" && isPullRequest)
      );
    });
    core.debug(`Config matches on 'issue_type': ${inspect(configMatches)}`);
    if (configMatches.length == 0) {
      const issueType = isPullRequest ? "pull request" : "issue";
      core.info(
github expo / expo-github-action / src / system.ts View on Github external
export async function patchWatchers() {
	if (process.platform !== 'linux') {
		return core.info('Skipping patch for watchers, not running on Linux...');
	}

	core.info('Patching system watchers for the `ENOSPC` error...');

	try {
		// see https://github.com/expo/expo-cli/issues/277#issuecomment-452685177
		await cli.exec('sudo sysctl fs.inotify.max_user_instances=524288');
		await cli.exec('sudo sysctl fs.inotify.max_user_watches=524288');
		await cli.exec('sudo sysctl fs.inotify.max_queued_events=524288');
		await cli.exec('sudo sysctl -p');
	} catch {
		core.warning('Looks like we can\'t patch watchers/inotify limits, you might encouter the `ENOSPC` error.');
		core.warning('For more info, https://github.com/expo/expo-github-action/issues/20');
	}
}
github chteuchteu / MaterialDesignIcons-Picker / tools / github-actions / open-pr-on-new-mdi-version / prepare-pr.js View on Github external
const upstreamVersions = {
        default: await upstream.getLatestVersion('default'),
        light: await upstream.getLatestVersion('light'),
    };
    core.info(`Found upstream versions default=${upstreamVersions.default}, light=${upstreamVersions.light}`);

    // Compare with locally installed versions
    const packageJsonPath = path.join(projectRoot, 'package.json');
    const packageJson = fs.readFileSync(packageJsonPath,'utf8');
    const jsonPackageJson = JSON.parse(packageJson);
    const localVersions = jsonPackageJson['materialdesignicons-picker'].version;
    core.info(`Found local versions default=${localVersions.default}, light=${localVersions.light}`);

    // Abort if same
    if (upstreamVersions.default === localVersions.default && upstreamVersions.light === localVersions.light) {
        core.info('No difference found in versions, aborting!');
        core.setOutput('proceed', 'no');
        return;
    }

    // Check if a PR already exists
    const octokit = new github.GitHub(process.env.REPO_ACCESS_TOKEN);
    const context = github.context;
    const { data: pullRequests } = await octokit.pulls.list({
        owner: context.repo.owner,
        repo: context.repo.repo,
        state: 'open',
        sort: 'created',
        direction: 'desc',
    });
    core.info(`Found ${pullRequests.length} PRs: `+pullRequests.map(pr => `"${pr.title}"`).join(', '));
    // Find the one with the right title
github ilammy / msvc-dev-cmd / index.js View on Github external
async function main() {
    if (process.platform != 'win32') {
        core.info('This is not a Windows virtual environment, bye!')
        return
    }

    const arch    = core.getInput('arch')
    const sdk     = core.getInput('sdk')
    const toolset = core.getInput('toolset')
    const uwp     = core.getInput('uwp')
    const spectre = core.getInput('spectre')

    // Due to the way Microsoft Visual C++ is configured, we have to resort to the following hack:
    // write a helper batch file which calls the configuration batch file and then outputs the
    // configured environment variables, which we then pass to GitHub Actions.

    const helper = path.join(os.homedir(), 'msvc-dev-cmd.bat')

    var args = [arch]
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 TimonVS / pr-labeler-action / src / action.ts View on Github external
async function action(context: Context = github.context) {
  try {
    core.info(JSON.stringify(context.payload))

    core.info(context.payload.repository!.owner.login)
    core.info(context.repo.owner)

    core.info(context.payload.repository!.name)
    core.info(context.repo.repo)

    core.info(context.payload.pull_request!.head.ref)
    core.info(context.ref)

    const GITHUB_TOKEN = process.env.GITHUB_TOKEN!
    const octokit = new github.GitHub(GITHUB_TOKEN)
    const repoInfo: RepoInfo = {
      owner: context.payload.repository!.owner.login,
      repo: context.payload.repository!.name
    }

    if (!context.payload.pull_request) {
      throw new Error(
        "Payload doesn't contain `pull_request`. Make sure this Action is being triggered by a pull_request event (https://help.github.com/en/articles/events-that-trigger-workflows#pull-request-event-pull_request)."
      )
    }

    const ref: string = context.ref
    const config = {
github actions-rs / grcov / src / configuration.ts View on Github external
async function loadUser(path: string): Promise {
    let contents = {};
    try {
        contents = yaml.safeLoad(await fs.readFile(path));
    } catch (error) {
        core.info(`Unable to load grcov config from the ${path}, falling back to defaults. ${error}`);
    }

    let user: User = {};
    if (contents['branch'] == true) {
        user.branch = true;
    }
    if (contents['ignore-not-existing'] == true) {
        user.ignoreNotExisting = true;
    }
    if (contents['llvm'] == true) {
        user.llvm = true;
    }
    if (contents['filter']) {
        user.filter = contents['filter'];
    }
    if (contents['ignore'] && Array.isArray(contents['ignore'])) {
github newrelic / newrelic-ruby-agent / .github / actions / 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 Flexget / webui / .github / actions / skip-deployment / index.js View on Github external
const { checks } = new GitHub(myToken);
  try {
    const { data } = await checks.listSuitesForRef({
      ...repo,
      ref,
    });
    const check = data.check_suites.find((s) => (
      s.app.slug === 'github-actions' && s.status === 'completed'
    ));
    if (!check || check.conclusion !== 'success') {
      setOutput('skip', 'true');
      setFailed(`Skipping deployment because tests failed to pass`);
      return;
    }

    info('Not skipping deployment');
    setOutput('skip', 'false');

  } catch(err) {
    setFailed(`Action failed with error ${err}`);
  }
}