Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 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! ###");
const core = require('@actions/core')
const { Toolkit } = require('actions-toolkit')
const fm = require('front-matter')
const nunjucks = require('nunjucks')
const dateFilter = require('nunjucks-date-filter')
function listToArray (list) {
if (!list) return []
return Array.isArray(list) ? list : list.split(', ')
}
Toolkit.run(async tools => {
const template = core.getInput('filename') || '.github/ISSUE_TEMPLATE.md'
const assignees = core.getInput('assignees')
const env = nunjucks.configure({ autoescape: false })
env.addFilter('date', dateFilter)
const templateVariables = {
...tools.context,
date: Date.now()
}
// Get the file
tools.log.debug('Reading from file', template)
const file = tools.getFile(template)
// Grab the front matter as JSON
const { attributes, body } = fm(file)
const { Toolkit } = require( 'actions-toolkit' );
Toolkit.run( async ( tools ) => {
try {
const { action, issue } = tools.context.payload;
if( action !== 'opened' ){
tools.exit.neutral( `Event ${ action } is not supported by this action.` )
}
// Get the arguments
const projectName = tools.arguments._[ 0 ];
const columnName = tools.arguments._[ 1 ];
const secret = process.env.GH_PAT ? process.env.GH_PAT : process.env.GITHUB_TOKEN;
// Fetch the column ids and names
const { resource } = await tools.github.graphql({
query: `query {
resource( url: "${ issue.html_url }" ) {
const { Toolkit } = require('actions-toolkit')
// Run your GitHub Action!
Toolkit.run(async tools => {
tools.exit.success('We did it!')
})
deployedCommit: process.env.GITHUB_SHA,
deployedBranch: process.env.GITHUB_REF,
};
if (!actionConfig.zeitToken) {
throw new Error(`ZEIT_TOKEN environment variable is not set`);
}
const zeitAPIClient = axios.create({
baseURL: 'https://api.zeit.co',
headers: { Authorization: `Bearer ${actionConfig.zeitToken}` },
params: { teamId: actionConfig.teamId },
});
// Run your GitHub Action!
Toolkit.run(async tools => {
function fetchLastDeployment(params) {
return zeitAPIClient
.get('/v4/now/deployments', { params })
.then(({ data }) => data.deployments[0]);
}
const strategies = [
fetchLastDeployment({ 'meta-commit': actionConfig.deployedCommit }),
fetchLastDeployment({ 'meta-branch': actionConfig.deployedBranch }),
fetchLastDeployment({ limit: 1 }),
];
let deploymentUrl;
let deploymentCommit;
let deploymentProjectName;
const {Toolkit} = require('actions-toolkit');
const {withDefaults} = require('actions-toolkit/lib/graphql');
Toolkit.run(async tools => {
// Re-authenticate with the correct secret.
tools.github.graphql = withDefaults(process.env.GRAPHQL_TOKEN);
// Ensure that the actor of the triggering action belongs to the core team
const actorLogin = tools.context.actor;
const teamResponse = await tools.github.graphql(`
query {
organization(login: "atom") {
team(slug: "github-package") {
members(first: 100) {
nodes {
login
}
}
}
}
return `❗️ ${capitalize(item.payload.action)} issue #${
item.payload.issue.number
} in ${item.repo.name}`
},
PullRequestEvent: item => {
const emoji = item.payload.action === 'opened' ? '💪' : '❌'
const line = item.payload.pull_request.merged
? '🎉 Merged'
: `${emoji} ${capitalize(item.payload.action)}`
return `${line} PR #${item.payload.pull_request.number} in ${
item.repo.name
}`
}
}
Toolkit.run(
async tools => {
const { GIST_ID, GH_USERNAME, GH_PAT } = process.env
// Get the user's public events
tools.log.debug(`Getting activity for ${GH_USERNAME}`)
const events = await tools.github.activity.listPublicEventsForUser({
username: GH_USERNAME,
per_page: 100
})
tools.log.debug(
`Activity for ${GH_USERNAME}, ${events.data.length} events found.`
)
const content = events.data
// Filter out any boring activity
.filter(event => serializers.hasOwnProperty(event.type))
const { Toolkit } = require('actions-toolkit')
const fetch = require('node-fetch')
const hash = require('object-hash')
Toolkit.run(async tools => {
// Serialize payload object
const payload = {
...tools.context.payload,
'smee-action': {
action: tools.context.action,
actor: tools.context.actor,
event: tools.context.event,
sha: tools.context.sha,
ref: tools.context.ref,
workflow: tools.context.workflow
}
}
// Serialize headers
const headers = {
'X-GitHub-Event': tools.context.event,
Toolkit.run(async tools => {
// Re-authenticate with the correct secret.
tools.github.graphql = withDefaults(process.env.GRAPHQL_TOKEN);
// Ensure that the actor of the triggering action belongs to the core team
const actorLogin = tools.context.actor;
const teamResponse = await tools.github.graphql(`
query {
organization(login: "atom") {
team(slug: "github-package") {
members(first: 100) {
nodes {
login
}
}
}
}
}
`);
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',