This repository was archived by the owner on Jun 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
37 lines (30 loc) · 1.37 KB
/
index.js
File metadata and controls
37 lines (30 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const github = require("@actions/github")
const core = require("@actions/core")
const { Octokit } = require("@octokit/action");
let gifURLs = [
'https://c.tenor.com/p29xMArwXB8AAAAd/samuel-l-jackson-silly.gif', //silly face sam
'https://c.tenor.com/8aKkFuCN7TsAAAAC/samuel-l-jackson-snakes-on-a-plane.gif', //snakes on a plane
'https://c.tenor.com/PUw8yTi8V5AAAAAC/samuel-l-jackson-shocked.gif', //oh-really-sam?!
'https://c.tenor.com/hIhNfnidIlkAAAAC/butts-release.gif', //jurassic park
'https://c.tenor.com/m36sCPqucWMAAAAC/samuel-jackson-pink.gif' //pink wig sam
]
async function runMain(){
try {
const randInt = function (min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
let message = `<img src="${gifURLs[randInt(0, gifURLs.length - 1)]}" width="200px" /> \n`
const octokit = new Octokit({auth: core.getInput('token')})
let res = await octokit.rest.issues.createComment({
issue_number: github.context.payload.issue.number,
owner: github.context.payload.repository.owner.login,
repo: github.context.payload.repository.name,
body: message + core.getInput('message')
})
console.log(res)
} catch( err ) {
console.log("There was an error executing the action: " + err)
core.setFailed(err.message)
}
}
runMain()