Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const { graphql } = require('@octokit/graphql')
const algoliasearch = require('algoliasearch')
const graphqlWithAuth = graphql.defaults({
headers: { authorization: `token ${process.env.GITHUB_TOKEN}` }
})
const client = algoliasearch('F8ONSWSRN9', process.env.ALGOLIA_APIKEY)
const index = client.initIndex('scoop_apps')
const tmpIndex = client.initIndex('scoop_apps_tmp')
;(async () => {
try {
// Get known buckets
const { repository } = await graphqlWithAuth(`
{
repository(owner: "lukesampson", name: "scoop") {
object(expression: "master:buckets.json") {
... on Blob {
text
}
function getGraphqlWithAuth(token) {
return graphql.defaults({
headers: {
authorization: `token ${token}`
}
});
}
function getGraphqlWithAuth(token) {
return graphql.defaults({
headers: {
authorization: `token ${token}`
}
});
}
getGraphqlWithAuth() {
const token = core.getInput('repo-token');
return graphql.defaults({
headers: {
authorization: `token ${token}`,
},
});
}