Skip to content
This repository was archived by the owner on Aug 16, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
4be1d02
updated deprecated code
IngridGdesigns Feb 2, 2023
72a51e1
installed octokit/rest
IngridGdesigns Feb 10, 2023
c3694be
npm audit fix
IngridGdesigns Feb 10, 2023
21ebf5e
added octokit typew
IngridGdesigns Feb 10, 2023
34d3afa
create SponsorabilityFetcher class
IngridGdesigns Feb 10, 2023
1b86b61
added findSponsorables to runExample.ts
IngridGdesigns Feb 10, 2023
cc638bf
added notes, and Contributor interface
IngridGdesigns Feb 10, 2023
beaf24c
read dependencies in file
IngridGdesigns Feb 10, 2023
18127b3
removed schema comments
IngridGdesigns Feb 10, 2023
9e7a39c
renamed type, added extract function, read file
IngridGdesigns Feb 10, 2023
a16ef51
update names
IngridGdesigns Feb 14, 2023
1ec03c8
updated interface
IngridGdesigns Feb 14, 2023
21d4467
added error handling in readJsonFile, fetching contributers, returni…
IngridGdesigns Feb 16, 2023
2a23189
added start in script
IngridGdesigns Feb 16, 2023
aac1262
added npm start info
IngridGdesigns Feb 16, 2023
89c3b10
remove comments, updated type
IngridGdesigns Feb 16, 2023
7cba834
added space, pulled out fileDir
IngridGdesigns Feb 16, 2023
fea2571
rename function
IngridGdesigns Feb 16, 2023
0f5f03d
rename const
IngridGdesigns Feb 16, 2023
32591fd
rename function
IngridGdesigns Feb 16, 2023
0d20952
fixed package-lock issue
IngridGdesigns Feb 16, 2023
978fc16
rename function
IngridGdesigns Feb 16, 2023
0711f82
added new class for contributors, and to get all sponsorables,
IngridGdesigns Feb 16, 2023
c419212
added query string mvp
IngridGdesigns Feb 16, 2023
759a12e
WIP comment
IngridGdesigns Feb 16, 2023
fc28270
fixed query, added list to-do, fetchSponsorData for single contributor
IngridGdesigns Feb 17, 2023
ffaf51b
added test data, iterating through contributors to fetchSponsorData
IngridGdesigns Feb 17, 2023
6b26eea
updated interfaces, added to fetchSponsorData
IngridGdesigns Feb 20, 2023
8315a2b
filtering out dependabots as contributors
IngridGdesigns Feb 21, 2023
6661eaf
console out data, stil lneed to test
IngridGdesigns Feb 21, 2023
ef53508
updated new query, corrected, got to update the rest
IngridGdesigns Feb 21, 2023
0c98ba6
updated Sponsorable interface
IngridGdesigns Feb 22, 2023
b51adb2
updated types
IngridGdesigns Feb 22, 2023
5d00b58
getting users with sponsorlisting, mvp
IngridGdesigns Feb 23, 2023
63be58b
added token scope reqs to readme
IngridGdesigns Feb 23, 2023
e4c2a88
added sponsorable output file path
IngridGdesigns Feb 23, 2023
e45df0c
added output path
IngridGdesigns Feb 23, 2023
96688a4
updated types, removed commented out code
IngridGdesigns Feb 23, 2023
6805fa6
updated typename, used test data, outputting data
IngridGdesigns Feb 23, 2023
c86c0cf
refactored code in function
IngridGdesigns Feb 24, 2023
28255a4
cleaned up file
IngridGdesigns Feb 24, 2023
a476e0c
WIP: add contributions count
IngridGdesigns Feb 24, 2023
bf789c1
fetch projectsContributions
IngridGdesigns Feb 24, 2023
c45250a
updated packages and tested
IngridGdesigns Feb 24, 2023
d7571ef
removed get contributions function, no accurate
IngridGdesigns Feb 24, 2023
c947882
added get project counts functiona
IngridGdesigns Feb 27, 2023
ab93109
added repo identifier, removed hardcoded file, removed read file fun…
IngridGdesigns Feb 28, 2023
01e0439
remove readFileJson, rename const
IngridGdesigns Feb 28, 2023
15c423e
set contributors by repo using Map
IngridGdesigns Feb 28, 2023
642b23f
refactored to use for of loop to insert data in Map
IngridGdesigns Feb 28, 2023
a9b3801
added reposFetcher class
IngridGdesigns Mar 1, 2023
f35e3db
added repos query
IngridGdesigns Mar 1, 2023
a32a879
added fetchContributorRepos function, bullding fetchContributorRepos
IngridGdesigns Mar 1, 2023
bcb4700
loop thorugh each user, save data in array
IngridGdesigns Mar 1, 2023
ee67531
add reposFetcher to sponsorabilityFetcher.ts
IngridGdesigns Mar 1, 2023
8c210a2
imported User interface, rename function
IngridGdesigns Mar 1, 2023
9615407
updated const name
IngridGdesigns Mar 1, 2023
2834406
rename const, fetchRepos graphql call
IngridGdesigns Mar 1, 2023
e185a7f
refactored to include repo information, remove comments
IngridGdesigns Mar 3, 2023
2e6c6a1
clean up
IngridGdesigns Mar 3, 2023
b57c567
rename of Contributor Interface
IngridGdesigns Mar 3, 2023
8315047
added createTsv file
IngridGdesigns Mar 3, 2023
cc47a12
removed url, rename const, remove slash
IngridGdesigns Mar 3, 2023
2705cff
remove log
IngridGdesigns Mar 3, 2023
0d0de0e
remove some comments
IngridGdesigns Mar 3, 2023
1654052
remove url in User interface
IngridGdesigns Mar 3, 2023
cd6dc49
fixed name, removed comment, added tuple
IngridGdesigns Mar 3, 2023
fb4e3cb
added WIP note
IngridGdesigns Mar 3, 2023
f39ab8e
rename consts and functions
IngridGdesigns Mar 3, 2023
4d237fe
added interfaces
IngridGdesigns Mar 3, 2023
e381e46
rename const, remove disable line
IngridGdesigns Mar 3, 2023
821b7e0
solve merge conflicts
IngridGdesigns Mar 3, 2023
0e9ce1e
updated and audited packages
IngridGdesigns Mar 3, 2023
8d8a4f7
another attempt to fix package-lock.json
IngridGdesigns Mar 3, 2023
1764d45
WIP: counting projects, counting language ocurrences
IngridGdesigns Mar 7, 2023
e217416
rename consts, rename functions, remove filteriing, return Map
IngridGdesigns Mar 9, 2023
2bae76c
created sponsorable fetcher, returning Sponsor[]
IngridGdesigns Mar 9, 2023
4a99fe4
rename file
IngridGdesigns Mar 9, 2023
f49fb3d
rename
IngridGdesigns Mar 9, 2023
43b4d54
set new map, rename function, erased comments
IngridGdesigns Mar 9, 2023
ce6b84f
add renamed class
IngridGdesigns Mar 9, 2023
1c5f64a
remove comments, old code, updated query and variable
IngridGdesigns Mar 10, 2023
8f1af56
moved code around, organized and renames
IngridGdesigns Mar 10, 2023
cb55b3c
renames
IngridGdesigns Mar 10, 2023
aff25fd
refactored and rename
IngridGdesigns Mar 10, 2023
cee908f
removed any, rename interface, added new function to count languages
IngridGdesigns Mar 10, 2023
078626a
counting languages
IngridGdesigns Mar 10, 2023
b13e753
found bug, added comments
IngridGdesigns Mar 10, 2023
d971349
refactor and adding extract owner and name function, removed interfac…
IngridGdesigns Mar 13, 2023
b17aa03
remove bogus code
IngridGdesigns Mar 13, 2023
a59b036
updated code, added space
IngridGdesigns Mar 13, 2023
4f7a715
cleaned up comments and added types to Map
IngridGdesigns Mar 13, 2023
4b95857
added forEach but consoled logged out, promises are not coming in
IngridGdesigns Mar 14, 2023
f64eac9
edited plan
IngridGdesigns Mar 14, 2023
14d0cf5
rename class
IngridGdesigns Mar 14, 2023
baf1cb8
rename class
IngridGdesigns Mar 14, 2023
3022316
added to interface WIP
IngridGdesigns Mar 14, 2023
8dd6348
remove repoIdentifiers from type and function in sponsorabiliity
IngridGdesigns Mar 14, 2023
173a290
await Promise.all solution to forEach, not applied yet
IngridGdesigns Mar 14, 2023
9decafc
rename consts
IngridGdesigns Mar 14, 2023
72a99f2
refactored code, found bug and returning a map of repoIdentifiers, Sp…
IngridGdesigns Mar 14, 2023
f9156d7
cleaned up, refactored, moved test data below
IngridGdesigns Mar 14, 2023
7a31ea3
removed types, renamed and returned a map, moved query into file
IngridGdesigns Mar 15, 2023
281a3f7
export languages interface, added key name
IngridGdesigns Mar 15, 2023
6145565
refactored, removed queryTemplate, rename interfaces
IngridGdesigns Mar 15, 2023
c037e08
commented out console.log
IngridGdesigns Mar 15, 2023
a7bc453
fixed duplication bug with brute force code
IngridGdesigns Mar 15, 2023
a0d108a
moved Promise.all comment to below active code
IngridGdesigns Mar 15, 2023
c9d748b
WIP: committing before cleaning , extracting functions, countContribu…
IngridGdesigns Mar 15, 2023
ef9d0d1
extracted function
IngridGdesigns Mar 15, 2023
99efda1
refactored and extracted loops to other functions
IngridGdesigns Mar 16, 2023
186d6b8
moved functions around
IngridGdesigns Mar 16, 2023
68d397f
renamed consts, extracted loops related to language count
IngridGdesigns Mar 16, 2023
874df87
deleted comments
IngridGdesigns Mar 16, 2023
86a7b21
added to-do
IngridGdesigns Mar 16, 2023
d99e63e
rename class
IngridGdesigns Mar 16, 2023
acbb92d
rename interface
IngridGdesigns Mar 16, 2023
2f9cc7d
rename interface to Sponsorable
IngridGdesigns Mar 16, 2023
d875fdf
rename const to repoId, sponsorables
IngridGdesigns Mar 16, 2023
481bf21
rename const
IngridGdesigns Mar 16, 2023
cc89c5b
avoiding using entries and adding error handling for login undefine case
IngridGdesigns Mar 16, 2023
68fcbc6
update function name and parameter name
IngridGdesigns Mar 16, 2023
b9cccaa
moved all types to single file
IngridGdesigns Mar 16, 2023
e8a7c47
remove unused code
IngridGdesigns Mar 17, 2023
354b043
moved Sponsorable to finder, added types, rename
IngridGdesigns Mar 17, 2023
f9cc361
update (due to rename), refactor, removed comments
IngridGdesigns Mar 17, 2023
e69ebea
implement renames, comment out code, removed contributionCounts from …
IngridGdesigns Mar 17, 2023
b02b4e6
added impact score
IngridGdesigns Mar 17, 2023
84a4d7b
WIP: created map of contributions count by contributor
IngridGdesigns Mar 18, 2023
31bacec
edited name
IngridGdesigns Mar 18, 2023
b523bc5
WIP: got counts of each contributor, needs refinement, its duplicating
IngridGdesigns Mar 20, 2023
f22cb46
erased unused code, to start fresh
IngridGdesigns Apr 3, 2023
d8fdb4a
more cleaning up
IngridGdesigns Apr 3, 2023
9206d75
removed duplicate note
IngridGdesigns Apr 3, 2023
ca0f75a
add function
IngridGdesigns Apr 3, 2023
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
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@ Please note that only the first 100 labels per issue will be fetched. If a singl

## Token

To run Mariner, you must create a token. The GitHub token must be a valid personal access token.
To run Mariner, you must create a token. The GitHub token must be a valid personal access token.
It requires one of the following scopes: ['user:email', 'read:user', 'read:org'] scopes.
Please modify your token's scopes at: https://github.com/settings/tokens."
It does not require any permissions beyond the default, so when you create it you can leave all
the boxes unchecked. Be careful not to share your token with anyone. If it gets exposed, revoke
it and create a replacement.
Expand Down Expand Up @@ -258,7 +260,7 @@ Run `nvm use` to use the appropiate version of Node specified in the .nvmrc file

Run `npm run build` to compile the code to Javascript.

Run `node dist/examples/runExample.js` (to use GraphQL) or `node dist/examples/runOldCode.ts` (to use REST calls), to run the example program. It requires internet access, since it calls the GitHub API. It will take a couple minutes to complete. Some of the output includes the word "ERROR", so don't panic.
Run `npm start` (to use GraphQL) or `node dist/examples/runOldCode.ts` (to use REST calls), to run the example program. It requires internet access, since it calls the GitHub API. It will take a couple minutes to complete. Some of the output includes the word "ERROR", so don't panic.

Ensure to lint your code by running `npm run lint` before submitting any code for review. Either manually fix the errors or run `npm run lint:fix` to automatically fix any errors.

Expand Down
1 change: 1 addition & 0 deletions examples/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
],
"inputFilePath": "examples/exampleData.json",
"outputFilePath": "examples/output.json",
"outputSponsorableFilePath": "examples/sponsorableOutput.tsv",
"daysAgoCreated": 90,
"numberOfReposPerCall": 1000
}
42 changes: 40 additions & 2 deletions examples/runExample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Optionally, you can have environment variables for INPUT_FILE_PATH and OUTPUT_FILE_PATH,
but they have defaults that will work with the standard development environment.
Then, run `npm run build`
Finally, run `node dist/examples/runExample.js`
Finally, run `npm start` or `node dist/examples/runExample.js`

You'll know it's run correctly if you have a new file
examples/output.json with some GitHub issues in it.
Expand Down Expand Up @@ -49,6 +49,7 @@ mariner.setLogger(logger);

logger.info(`Input: ${path.resolve(config.inputFilePath)}`);
logger.info(`Output: ${path.resolve(config.outputFilePath)}`);
logger.info(`Sponsorable Output: ${path.resolve(config.outputSponsorableFilePath)}`);
logger.info(`Fetching issues from the last ${config.daysAgoCreated} days`);

const contents = fs.readFileSync(config.inputFilePath, {
Expand All @@ -60,13 +61,14 @@ const repositoryIdentifiers = Object.keys(countsByLibrary);
const prefix = 'https://api.github.com/repos/';
const repositoryLookupName = repositoryIdentifiers.map((identifier) => {
if (identifier.startsWith(prefix)) {
return identifier.substr(prefix.length);
return identifier.substring(prefix.length);
} else {
return identifier;
}
});

const finder = new mariner.IssueFinder(config);
const fetchSponsorables = new mariner.SponsorabilityFetcher(config);

function convertToRecord(issues: Map<string, mariner.Issue[]>): Record<string, mariner.Issue[]> {
const record: Record<string, mariner.Issue[]> = {};
Expand All @@ -84,6 +86,42 @@ function outputToJson(record: Record<string, mariner.Issue[]>): void {
fs.writeFileSync(config.outputFilePath, jsonResults);
}

fetchSponsorables
.fetchSponsorabilityInformation(token, repositoryLookupName)
.then((results) => {
console.log(results.length);
console.log(results, 'line 98 in runExample file');

/* output 2
[
{
type: 'User',
email: 'mvdan@mvdan.cc',
login: 'mvdan',
url: 'https://github.com/mvdan',
sponsorListingName: 'sponsors-mvdan'
},
{
type: 'User',
email: 'kzm@zkat.tech',
login: 'zkat',
url: 'https://github.com/zkat',
sponsorListingName: 'sponsors-zkat'
}
] line 98 in runExample file*/

fs.writeFileSync(
config.outputSponsorableFilePath,
`${JSON.stringify(results, undefined, 2)}`
);

// logger.info(`Saved User results to: ${config.outputSponsorableFilePath}`);
})
.catch((err: { message: string }) => {
logger.error(err.message);
console.log(err);
});

finder
.findIssues(token, repositoryLookupName)
.then((issues) => {
Expand Down
1 change: 1 addition & 0 deletions examples/sponsorableOutput.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Loading