Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

github-resource-converter (grc)

node v8.17.0
version: 1.0.1
endpointsharetweet
FEATURES COVERED 1. IMPORT github-resource-converter. 2. OPTIONS: View all (default) options. 3. ISSUES: get all open and closed issues for a GitHub (or GitHub Enterprise) repository. 4. LOGGER: output the issues using the logger. 5. PULL REQUESTS: get all open and closed pull requests for a GitHub (or GitHub Enterprise) repository. 6. ALL: get all open and closed issues and pull requests for a GitHub (or GitHub Enterprise) repository. 7. CONVERT GitHub (or GitHub Enterprise) issues to CSV. 8. SAVE: write data to the filesystem. -----------------------------------------
1. Import github-resource-converter.
const grc = require('github-resource-converter') // Initialze a couple of variables for convenience. const WHITESPACE = 2 const apiOptions = { owner: 'democracy-ia', repo: 'govinfo-link-js' } grc
2. Options: View all (default) options.
grc.options
3. ISSUES: get all open and closed issues for a GitHub (or GitHub Enterprise) repository.
const issues = await grc.issues.getForRepo(apiOptions) // Output all issues JSON.stringify(issues, null, WHITESPACE)
4. LOGGER: output the issues using the logger.
const FIRST = 0 grc.logger.info(issues[FIRST])
5. PULL REQUESTS: get all open and closed pull requests for a GitHub (or GitHub Enterprise) repository.
const pullRequests = await grc.pullRequests.getForRepo(apiOptions) JSON.stringify(pullRequests, null, WHITESPACE)
6. ALL: get all open and closed issues and pull requests for a GitHub (or GitHub Enterprise) repository.
const allIssuesAndPrs = await grc.getAll(apiOptions) JSON.stringify(allIssuesAndPrs, null, WHITESPACE)
7. Convert all GitHub (or GitHub Enterprise) issues to CSV.
const csv = await grc.toCsv({ allIssuesAndPrs }) csv
8. SAVE: write data to the filesystem.
const data = [{ "url": "https://api.github.com/repos/democracy-ia/govinfo-link-js/issues/7", "repository_url": "https://api.github.com/repos/democracy-ia/govinfo-link-js", "labels_url": "https://api.github.com/repos/democracy-ia/govinfo-link-js/issues/7/labels{/name}", "comments_url": "https://api.github.com/repos/democracy-ia/govinfo-link-js/issues/7/comments", "events_url": "https://api.github.com/repos/democracy-ia/govinfo-link-js/issues/7/events", "html_url": "https://github.com/democracy-ia/govinfo-link-js/issues/7", "id": 309583334, "number": 7, "title": "refactor(client): use unmodified javascript-client from swagger-codegen" }] grc.save({ data })
Loading…

no comments

    sign in to comment