Skip to content

Instantly share code, notes, and snippets.

@dgrammatiko
Created January 7, 2022 19:30
Show Gist options
  • Save dgrammatiko/8dcabcb710373c892b6eef1eacd96c7f to your computer and use it in GitHub Desktop.
Save dgrammatiko/8dcabcb710373c892b6eef1eacd96c7f to your computer and use it in GitHub Desktop.
Get all open Joomla issues
/**
* 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