Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion core/deployer/recipeEngine.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ const taskDownloadGithub = async (options, basePath, deployerCtx) => {
if (!validatorDownloadGithub(options)) throw new Error('invalid options');
//FIXME: caso seja eperm, tentar criar um arquivo na pasta e checar se funciona

const githubToken = process.env.GITHUB_TOKEN;
const githubApiHeaders = githubToken
? { Authorization: `Bearer ${githubToken}` }
: {};

//Parsing source
deployerCtx.$step = 'task start';
const srcMatch = options.src.match(githubRepoSourceRegex);
Expand All @@ -112,7 +117,8 @@ const taskDownloadGithub = async (options, basePath, deployerCtx) => {
const data = await got.get(
`https://api.github.com/repos/${repoOwner}/${repoName}`,
{
timeout: { request: 15e3 }
timeout: { request: 15e3 },
headers: githubApiHeaders,
}
).json();
if (typeof data !== 'object' || !data.default_branch) {
Expand All @@ -132,6 +138,7 @@ const taskDownloadGithub = async (options, basePath, deployerCtx) => {
const gotOptions = {
timeout: { request: 150e3 },
retry: { limit: 5 },
headers: githubApiHeaders,
};
const gotStream = got.stream(downURL, gotOptions);
gotStream.on('downloadProgress', (progress) => {
Expand Down