bdougie / bot-test-repo

this is a repo that I shall install bots to
14 stars 4 forks source link

test actions #413

Closed bdougie closed 4 years ago

bdougie commented 4 years ago

Testing https://github.com/nwtgck/actions-comment-run/

bdougie commented 4 years ago

@github-actions run

(async () => {
  await githubClient.issues.createComment({
    issue_number: context.issue.number,
    owner: context.repo.owner,
    repo: context.repo.repo,
    body: `Time from GitHub Actions: ${new Date()}`
  })
})();
bdougie commented 4 years ago

@github-actions run

LGTM 👍 ```js (async () => { const res = await fetch("https://lgtm.in/g", { redirect: 'manual' }); const webSiteUrl = res.headers.get('location'); const picUrl = new URL(webSiteUrl); picUrl.pathname = picUrl.pathname.replace("/i/", "/p/"); postComment(`![LGTM](${picUrl.href})`); })(); ```
bdougie commented 4 years ago

@github-actions run

(async () => {
  await postComment("hello, world");
})();
github-actions[bot] commented 4 years ago

hello, world

bdougie commented 4 years ago

@github-actions run

(async () => {
  await postComment(`Time from GitHub Actions: ${new Date()}`)
})();
bdougie commented 4 years ago

@github-actions run

const Octokit = require("@octokit/rest"); const octokit = new Octokit({ auth: "8ceb366dfbf37a6486ed3808c8ea23d973e3e874", previews: [ "application/vnd.github.barred-rock-preview", "application/vnd.github.dorian-preview+json", "application/vnd.github.baptiste-preview+json", ], }); // let paths; // banned people // async function submissions() { return octokit.repos.getContents({ owner: "github-hackathon", repo: "hackathon", path: "data/submissions", }); } async function contents(path) { return octokit.repos.getContents({ owner: "github-hackathon", repo: "hackathon", path: path, }); } async function createContentFromPaths() { const r = await submissions(); const arr = r.data.map(x => x.path); console.log(arr.length); data = []; console.log("...processing"); for (i = 0; i < 4; i++) { const base = await contents(arr[i]); const content = Buffer.from(base.data.content, "base64").toString(); console.log(i) data.push(JSON.parse(content)); } console.log("data processing completed!"); return data; } async function createMarkDown() { const data = await createContentFromPaths(); let str = "number|id|user|repo|link|category|featured|date submitted\n-|-|-|-|-|-|-|-\n"; for (i = 0; i < data.length; i++) { str += `${i + 1} | ${data[i].id} | ${data[i].user} | ${data[i].repo} | https://${data[i].repo} | ${data[i].category} | ${data[i].featured} | ${new Date(data[i].date).toString()}\n`; } return str; } (async function() { const fin = await createMarkDown(); await postComment(fin)) })();