-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get entire repo comments on app install #66
Open
aleku399
wants to merge
12
commits into
master
Choose a base branch
from
alex/install
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9575851
waiting for reviews #54
aleku399 77f753e
reviewed changes #54
aleku399 d462651
w.i.p
aleku399 4c74d3e
adding a recursive function to get files
aleku399 283e49e
Merge branch 'alex/install'
aleku399 218755b
updated files
aleku399 66b2bbf
refactoring some
aleku399 6085f41
adding types
aleku399 781e4b0
getting file names on install of the github app
aleku399 98c187d
minor correction
aleku399 f63f96b
creating github issues on install
aleku399 49e856e
correcting returned type for file Promises
aleku399 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
import { Context } from "../lib/github/types"; | ||
import { addRepoCommentsToGH } from "../lib"; | ||
import { addRepoCommentsToGH, addCommentsToGHonInstall } from "../lib"; | ||
|
||
module.exports = app => { | ||
app.log("Cheers, the app runs on a server!"); | ||
|
||
app.on("push", async (context: Context) => { | ||
addRepoCommentsToGH(context); | ||
}); | ||
|
||
app.on("installation", async (context: Context) => { | ||
addCommentsToGHonInstall(context); | ||
}); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Gets files that have changed in the last commits | ||
*/ | ||
import { Context, ModifiedFile, File } from "./types"; | ||
import { getBasicRepoProps, getfileName } from "./utils"; | ||
|
||
export default async function getFiles(context: Context): Promise<ModifiedFile[]> { | ||
const { owner, repo } = getBasicRepoProps (context); | ||
const sha = context.payload.head_commit.id; | ||
const octokit = context.github; | ||
const treeObject = await octokit.gitdata.getTree({owner, repo, sha, recursive: 5}); | ||
const filePromises: Array<Promise<File>> = treeObject.tree.map( async (obj) => { | ||
return getfileName(octokit, owner, repo, obj.sha); | ||
}); | ||
const arrFile = await Promise.all(filePromises); | ||
const modifiedFiles: Array<Promise<ModifiedFile>> = arrFile.map( async (objFile: File) => { | ||
const content = await octokit.repos.getContents({owner, repo, path: objFile.name}); | ||
return { | ||
name: objFile.name, | ||
htmlUrl: content.html_url, | ||
downloadUrl: content.download_url, | ||
author: owner | ||
}; | ||
}); | ||
return Promise.all(modifiedFiles); | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe comment should change. I think it should be something like
Get all repo files.