Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Filter matching commands by whether or not to allow edits
if (github.context.payload.action == "edited") {
configMatches = configMatches.filter(function(cmd) {
return cmd.allow_edits;
});
core.debug(`Config matches on 'allow_edits': ${inspect(configMatches)}`);
if (configMatches.length == 0) {
core.info(
`Command '${commentWords[0]}' is not configured to allow edits.`
);
return;
}
}
// Set octokit clients
const octokit = new github.GitHub(inputs.token);
const reactionOctokit = inputs.reactionToken
? new github.GitHub(inputs.reactionToken)
: new github.GitHub(inputs.token);
// At this point we know the command is registered
// Add the "eyes" reaction to the comment
if (inputs.reactions)
await addReaction(
reactionOctokit,
github.context.repo,
commentId,
"eyes"
);
// Get the actor permission
const actorPermission = await getActorPermission(
configMatches = configMatches.filter(function(cmd) {
return cmd.allow_edits;
});
core.debug(`Config matches on 'allow_edits': ${inspect(configMatches)}`);
if (configMatches.length == 0) {
core.info(
`Command '${commentWords[0]}' is not configured to allow edits.`
);
return;
}
}
// Set octokit clients
const octokit = new github.GitHub(inputs.token);
const reactionOctokit = inputs.reactionToken
? new github.GitHub(inputs.reactionToken)
: new github.GitHub(inputs.token);
// At this point we know the command is registered
// Add the "eyes" reaction to the comment
if (inputs.reactions)
await addReaction(
reactionOctokit,
github.context.repo,
commentId,
"eyes"
);
// Get the actor permission
const actorPermission = await getActorPermission(
octokit,
github.context.repo,
const run = async () => {
try {
const organization = core.getInput('organization', { required: true })
const teamName = core.getInput('team')
const comment = core.getInput('comment')
const { ACCESS_TOKEN } = process.env
if (!ACCESS_TOKEN)
return core.setFailed('ENV required and not supplied: ACCESS_TOKEN')
const { payload, sha } = github.context
const { repository } = payload
const octokit = new github.GitHub(ACCESS_TOKEN)
const commit = await octokit.git.getCommit({
owner: repository.owner.login,
repo: repository.name,
commit_sha: sha
})
const isMergeCommit = commit.data.parents.length > 1
if (!isMergeCommit) return
const {
data: [pullRequest]
} = await octokit.repos.listPullRequestsAssociatedWithCommit({
owner: repository.owner.login,
repo: repository.name,
commit_sha: sha
async function main() {
const AsyncFunction = Object.getPrototypeOf(async () => {}).constructor
const token = core.getInput('github-token', {required: true})
const debug = core.getInput('debug')
const userAgent = core.getInput('user-agent')
const previews = core.getInput('previews')
const opts: {[key: string]: any} = {}
if (debug === 'true') opts.log = console
if (userAgent != null) opts.userAgent = userAgent
if (previews != null) opts.previews = previews.split(',')
const client = new GitHub(token, opts)
const script = core.getInput('script', {required: true})
const fn = new AsyncFunction('require', 'github', 'context', script)
const result = await fn(require, client, context)
let encoding = core.getInput('result-encoding')
encoding = encoding ? encoding : 'json'
let output
switch (encoding) {
case 'json':
output = JSON.stringify(result)
break
case 'string':
output = String(result)
break
async function run() {
try {
const token = core.getInput('repo_token', { required: true });
const file = core.getInput('file', { required: true });
const asset_name = core.getInput('asset_name', { required: true });
const tag = core.getInput('tag', { required: true }).replace("refs/tags/", "");
const overwrite = core.getInput('overwrite');
if (!fs.existsSync(file)) {
core.setFailed(`File ${file} wasn't found.`);
}
const octokit = new github.GitHub(token);
const context = github.context;
const release = await get_release_by_tag(tag, octokit, context);
await upload_to_release(release, file, asset_name, tag, overwrite, octokit, context);
} catch (error) {
core.setFailed(error.message);
}
}
async function run() {
try {
const token: string = core.getInput("repo-token", { required: true });
const octokit = new github.GitHub(token);
const context = github.context;
const check = await octokit.checks.create({
...context.repo,
name: "goodpractice",
head_sha: context.sha,
status: "in_progress"
});
await exec.exec("Rscript", [
"-e",
"x <- goodpractice::goodpractice()",
"-e",
'capture.output(print(x), file = ".goodpractice")'
]);
async function run() {
const api = new github.GitHub(myToken);
const { data: releases } = await api.repos.listReleases( github.context.repo );
let published = releases.filter( release =>
! release.draft && ! release.prerelease
);
let sorted = published.sort( ( a, b ) =>
semver.rcompare( semver.coerce( a.tag_name ), semver.coerce( b.tag_name ) )
);
let changelog = sorted.reduce( ( changelog, release ) =>
`${changelog}
### ${release.tag_name} ###
async function run() {
const { repo, ref } = context;
const { repos } = new GitHub(proces.env.GITHUB_TOKEN);
try {
await repos.createDeployment({
...repo,
ref: ref.slice(11),
});
} catch(err) {
setFailed(`Action failed with err ${err}`);
}
}
async function run() {
const myToken = getInput('token');
const { repo, ref } = context;
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');