Created
January 7, 2022 19:30
-
-
Save dgrammatiko/8dcabcb710373c892b6eef1eacd96c7f to your computer and use it in GitHub Desktop.
Get all open Joomla issues
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
/** | |
* Needs npm init | |
* Needs npm install octokit | |
* Needs npm install dotenv | |
*/ | |
const fs = require('fs'); | |
const { Octokit } = require("octokit"); | |
require('dotenv').config() | |
const octokit = new Octokit({ | |
// Either provide an .env file with a user token or mute the next line | |
auth: process.env.GITHUB_AUTH_TOKEN, | |
log: { | |
debug: () => {}, | |
info: () => {}, | |
warn: console.warn, | |
error: console.error | |
}, | |
request: { | |
agent: undefined, | |
fetch: undefined, | |
timeout: 0 | |
} | |
}); | |
const main = async () => { | |
[...await octokit.paginate("GET /repos/joomla/joomla-cms/issues")].forEach(issue => { | |
if ( | |
issue.state === 'open' | |
&& issue.locked === false | |
&& !issue.pull_request | |
) { | |
finalIssues.push({ | |
title: issue.title, | |
id: issue.number, | |
url: issue.html_url, | |
body: issue.body, | |
}); | |
} | |
}); | |
console.log(finalIssues) | |
fs.writeFileSync('./issues.csv', finalIssues.map(i => `'${i.id}'\t'${i.title}'\t'${i.body}'\t'${i.url}'`).join('\t')); | |
fs.writeFileSync('./issues.json', JSON.stringify(finalIssues)); | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment