How to use the actions-toolkit.Toolkit function in actions-toolkit

To help you get started, weā€™ve selected a few actions-toolkit 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 JCofman / webPagetestAction / entrypoint.js View on Github external
// entrypoint.js
const { Toolkit } = require("actions-toolkit");
const tools = new Toolkit();
const webPageTest = require("webpagetest");
const argv = tools.arguments;

const { event, payload, sha } = tools.context;

// check pre-requirements
if (!checkForMissingEnv) tools.exit.failure("Failed!");

// run the script
runAudit();

async function runAudit() {
  try {
    if (event === "push") {
      tools.log("### Action triggered! ###");
github CalderaWP / Caldera-Forms / .github / generate-zip / entrypoint.js View on Github external
const { Toolkit } = require('actions-toolkit')
const tools = new Toolkit();
const path = require( 'path');
console.log('Hi Roy');
var ncp = require('ncp').ncp;
const rimraf = require( 'rimraf' );
ncp.limit = 16;
const sourcePath =  path.join(__dirname, '../..');
const resultPath = __dirname + '/build';
const zipPath = __dirname + '/caldera-forms.zip';
const zipFolder = require('zip-folder');
const fs = require( 'fs-extra' );




const clients = [
	'pro',
github banyan / auto-label / dist / entrypoint.js View on Github external
___scope___.file("entrypoint.js", function(exports, require, module, __filename, __dirname){

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fs = require("fs");
const path = require("path");
const actions_toolkit_1 = require("actions-toolkit");
const query_1 = require("./query");
const util_1 = require("./util");
const util = require("util");
const ignore_1 = require("ignore");
const exec = util.promisify(require('child_process').exec);
const configFile = '.github/auto-label.json';
const tools = new actions_toolkit_1.Toolkit({
    event: ['pull_request.opened', 'pull_request.synchronize'],
});
(async () => {
    if (!fs.existsSync(path.join(tools.workspace, configFile))) {
        tools.exit.neutral('config file does not exist.');
    }
    const config = JSON.parse(tools.getFile(configFile));
    let result;
    try {
        result = await query_1.getPullRequestAndLabels(tools, tools.context.issue());
    }
    catch (error) {
        console.error('Request failed: ', error.request, error.message);
        tools.exit.failure('getPullRequestAndLabels has been failed.');
    }
    console.log('Result: ', result);
github banyan / auto-label / src / entrypoint.ts View on Github external
import * as fs from 'fs';
import * as path from 'path';
import { Toolkit } from 'actions-toolkit';
import {
  addLabelsToLabelable,
  removeLabelsFromLabelable,
  getPullRequestAndLabels,
} from './query';
import { Label, FileEdge, LabelEdge, LabelName } from './interface';
import { getLabelIds } from './util';
import * as util from 'util';
import ignore from 'ignore';

const exec = util.promisify(require('child_process').exec);
const configFile = '.github/auto-label.json';
const tools = new Toolkit({
  event: ['pull_request.opened', 'pull_request.synchronize'],
});

(async () => {
  if (!fs.existsSync(path.join(tools.workspace, configFile))) {
    tools.exit.neutral('config file does not exist.');
  }

  const config = JSON.parse(tools.getFile(configFile));

  let result;

  try {
    result = await getPullRequestAndLabels(tools, tools.context.issue());
  } catch (error) {
    console.error('Request failed: ', error.request, error.message);
github matchai / criterion-compare-action / entrypoint.js View on Github external
const { Toolkit } = require("actions-toolkit");
const tools = new Toolkit({
  event: ["pull_request.opened", "pull_request.synchronize"]
});

async function main() {
  tools.log("### Benchmark starting ###");
  await tools.runInWorkspace("cargo", [
    "bench",
    "--",
    "--save-baseline",
    "changes"
  ]);
  tools.log("Changes benchmarked");
  await tools.runInWorkspace("git", ["checkout", "master"]);
  tools.log("Checked out to master branch");
  await tools.runInWorkspace("cargo", [
    "bench",
github probot / stale-action / index.js View on Github external
module.exports = async tools => {
  if (!tools) {
    tools = new Toolkit({
      event: [
        'issue_comment',
        'issues',
        'pull_request',
        'pull_request_review',
        'pull_request_review_comment',
        'repository_dispatch'
      ]
    })
  }

  tools.log.star(`Received ${tools.context.event}!`)
  tools.log.start('Stale action is booting up!')
  tools.log.pending('Retrieving Stale config from `.github/stale.yml`...')
  const config = buildConfig(tools)
github lannonbr / deploy-lambda-action / pr-comment / index.js View on Github external
const { Toolkit } = require("actions-toolkit");
const tools = new Toolkit();
const octokit = tools.createOctokit();

const fs = require("fs");
const eventJSON = tools.context.payload;
const number = eventJSON.pull_request.number;

const commentBody = `
This is LambdaBot šŸ¤–. I see that this PR has been merged into Master. I can help deploy the changes for you to AWS Lambda.

If you wish for my help, type !deploy as a new comment on this PR. Only users with push access to the repo will be allowed to push to Lambda.
`;

const params = tools.context.repo({ number, body: commentBody });
octokit.issues.createComment(params);
github gatsbyjs / gatsby / .github / actions / high-priority-prs / src / fetch.js View on Github external
const { Toolkit } = require("actions-toolkit")
const tools = new Toolkit()
const query = `
query GitHubOpenPullRequestsQuery {
    repository(name: "gatsby", owner: "gatsbyjs") {
      pullRequests(
        orderBy: { direction: ASC, field: UPDATED_AT }
        first: 100
        states: OPEN
        baseRefName: "master"
      ) {
        totalCount
        nodes {
          createdAt
          updatedAt
          title
          url
          author {
github helaili / github-graphql-action / entrypoint.js View on Github external
const axios = require('axios')
const yaml = require('node-yaml')
const fs = require('fs')
const { execSync } = require('child_process')
const { Toolkit } = require('actions-toolkit')
const tools = new Toolkit()

let options = {
  headers: {
    Authorization: `bearer ${tools.token}`
  }
}

let url = 'https://api.github.com/graphql'
if (tools.arguments.url) {
  url = tools.arguments.url
}

let outputFile = 'github-graphql-action.json'
if (tools.arguments.output) {
  outputFile = tools.arguments.output
}

actions-toolkit

A toolkit for building GitHub Actions in Node.js

MIT
Latest version published 4 years ago

Package Health Score

59 / 100
Full package analysis