Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: invalid username or repos, timeout error #22 #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
33 changes: 18 additions & 15 deletions util.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,27 @@ async function writeDocsWithConfig(user, repo, readmeData, config) {
async function getReadme(user, repo) {
mainConfig.user = user;
mainConfig.repo = repo;
try {
const readme = await axios.get(
`https://api.github.com/repos/${user}/${repo}/readme`
);
const readmeUrl = readme.data.download_url;
const readmeData = await axios.get(readmeUrl);

const readme = await axios.get(
`https://api.github.com/repos/${user}/${repo}/readme`
);
const readmeUrl = readme.data.download_url;
const readmeData = await axios.get(readmeUrl);

if (!fs.existsSync("./_docs/")) {
fs.mkdirSync("./_docs/");
}
if (!fs.existsSync("./_docs/")) {
fs.mkdirSync("./_docs/");
}

if (!fs.existsSync(`./_docs/${user}-${repo}/`)) {
fs.mkdirSync(`./_docs/${user}-${repo}/`);
}
if (!fs.existsSync(`./_docs/${user}-${repo}/`)) {
fs.mkdirSync(`./_docs/${user}-${repo}/`);
}

// Write file only if github readme is different from local copy
if (isDiffReadme(user, repo, readmeData.data)) {
await writeDocs(user, repo, readmeData.data);
// Write file only if github readme is different from local copy
if (isDiffReadme(user, repo, readmeData.data)) {
await writeDocs(user, repo, readmeData.data);
}
} catch (error) {
return;
}
}

Expand Down