-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from dxw/add-open-prs
Add open PRs to dashboard
- Loading branch information
Showing
8 changed files
with
60 additions
and
22 deletions.
There are no files selected for viewing
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
22 changes: 17 additions & 5 deletions
22
dataScripts/fetchAllRepos.js → utils/githubApi/fetchAllRepos.js
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const getOpenPRsForRepo = ({ octokit, repository }) => { | ||
return octokit.request(repository.pulls_url).then(handlePrsApiResponse); | ||
}; | ||
|
||
export const handlePrsApiResponse = ({ data }) => data?.length || 0; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { describe, it } from "node:test"; | ||
import expect from "node:assert"; | ||
import { handlePrsApiResponse } from "./fetchOpenPrs.js"; | ||
|
||
describe("handlePrsApiResponse", () => { | ||
it("returns the length of the array containing PRs", () => { | ||
expect.equal(handlePrsApiResponse({ data: [1, 2, 3] }), 3); | ||
}); | ||
|
||
it("returns 0 if there are no open PRs", () => { | ||
expect.equal(handlePrsApiResponse({ data: undefined }), 0); | ||
}); | ||
}); |
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
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
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
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