Last active
November 7, 2020 09:08
-
-
Save fogrew/e3fcf2c23d6aab7c08d78096bf81c0ca to your computer and use it in GitHub Desktop.
get github issues with label
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let eventsList = []; | |
require('./getGithub').then((data) => { | |
for (event in data) { | |
eventsList.push({ | |
title: event.title, | |
url: event.html_url | |
}); | |
} | |
console.log(eventsList); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const https = require('https'); | |
const defaults = { | |
host: 'api.github.com', | |
path: '/repos/nodeschool/spb/issues?state=all&labels=%D0%9C%D0%B5%D1%80%D0%BE%D0%BF%D1%80%D0%B8%D1%8F%D1%82%D0%B8%D0%B5', | |
headers: { | |
'User-Agent': 'request' | |
} | |
}; | |
const getGithub = function(options) { | |
Object.assign(defaults, options); | |
return new Promise((resolve, reject) => { | |
const request = https.get(options, (response) => { | |
const body = []; | |
response.on('data', (chunk) => { | |
body.push(chunk); | |
}); | |
response.on('end', () => { | |
resolve(body.join('')); | |
}); | |
}); | |
request.on('error', (err) => { | |
reject(err); | |
}); | |
}); | |
}; | |
module.exports = getGithub; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const data = require('gulp-data'); | |
const nunjucks = require('gulp-nunjucks-render'); | |
var getDataForFile = function(file) { | |
const variablesFile = path.join(process.cwd(), paths.viewsDir, 'pages', path.dirname(file.relative), 'data.js'); | |
return require(variablesFile); | |
}; | |
gulp.task('markup', function() { | |
return gulp.src(paths.dev.pages) | |
.pipe(data(getDataForFile)) | |
.pipe(nunjucks({ | |
path: paths.viewsDir | |
})) | |
.pipe(gulp.dest(paths.dist.pages)) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment