diff --git a/action.js b/action.js index 3d524f8..a383973 100755 --- a/action.js +++ b/action.js @@ -36,61 +36,21 @@ for await (const line of rl) { } } images = getRandom(images, 10); +full_images = [] for (const image of images) { - console.log(``); + full_images.push(``); +} +console.error(full_images.join('\n\n')); +try { + console.log(github.context); + const octokit = new github.getOctokit(process.env.GITHUB_TOKEN); + const new_comment = octokit.issues.createComment({ + owner: 'cirosantilli', + repo: context.payload.repository.name, + issue_number: context.payload.pull_request.number, + body: 'asdf' + }); +} catch (error) { + core.setFailed(error.message); } - -//const token = core.getInput("token"); -//const context = github.context; -//if (context.payload.pull_request == null) { -// core.setFailed('No pull request found.'); -// return; -//} -//const pull_request_number = context.payload.pull_request.number; -//const pull_request_number = 237; -//const octokit = new github.GitHub(process.env.GITHUB_TOKEN); -//const new_comment = octokit.issues.createComment({ -// ...context.repo, -// issue_number: pull_request_number, -// body: 'asdf' -//}); - -console.log(github.context); -//const token = core.getInput("token"); -const pull_request_number = ; -const octokit = new github.getOctokit(process.env.GITHUB_TOKEN); -const new_comment = octokit.issues.createComment({ - owner: 'cirosantilli', - repo: context.payload.repository.name, - issue_number: context.payload.pull_request.number, - body: 'asdf' -}); - -//const pull_request_number = 237; -//console.error(github); -//const octokit = new github.getOctokit(process.env.GITHUB_TOKEN); -//const new_comment = octokit.issues.createComment({ -// owner: 'cirosantilli', -// repo: 'china-dictatorship', -// issue_number: pull_request_number, -// body: 'asdf' -//}); - })() - -//import random -//import re -// -//image_re = re.compile() -// -//images = [] -//with open('README.adoc', 'r') as f: -// for line in f: -// line = line.rstrip() -// match = image_re.match(line) -// if match: -// images.append(match.group(1)) -// -//images = random.sample(images, 10) -//for image in images: -// print(''.format(image))