webbertakken / reviewer

PR Code Reviewer
https://github.com/marketplace/pr-code-reviewer
MIT License
22 stars 2 forks source link

GitHub service #6

Closed Ariel-Rodriguez closed 1 year ago

Ariel-Rodriguez commented 1 year ago

Changes

github service to provide latest file changes from most recent PR from the repo.

[1] Authenticating with Github App... 86938153a10744aad43d29dd1cf0c3aa2ab0e67b
[1] Fetching most recent pull request...
[1] Fetching file contents and patches for pull request #6...
[1] [
[1]   {
[1]     filename: 'src/main.ts',
[1]     content: "// import { updateInstances } from './logic/update-instances'\n" +
[1]       "import { GithubApi } from './services/github-api'\n" +
[1]       "// import { gpt } from './services/gpt'\n" +
[1]       "import { checkEnv } from './logic/check-env'\n" +
[1]       '\n' +
[1]       'export const main = async () => {\n' +
[1]       '  if (!checkEnv()) return\n' +
[1]       '\n' +
[1]       "  console.log('Hello World')\n" +
[1]       '\n' +
[1]       '  const ghAppClientSecret = process.env.GH_APP_CLIENT_SECRET\n' +
[1]       '  const ghApi = new GithubApi({\n' +
[1]       "    repoName: 'reviewer',\n" +
[1]       "    repoOwner: 'webbertakken',\n" +
[1]       "    installationId: '39090441',\n" +
[1]       "    appId: '353840',\n" +
[1]       "    privateKey: ghAppClientSecret || '',\n" +
[1]       '  })\n' +
[1]       '\n' +
[1]       '  try {\n' +
[1]       '    const result = await ghApi.getFileChanges(4)\n' +
[1]       '    console.log(result)\n' +
[1]       '  } catch (error) {\n' +
[1]       "    console.error('Error fetching pull request information:', error)\n" +
[1]       '  }\n' +
[1]       '  // List instances\n' +
[1]       '  // await updateInstances(github)\n' +
[1]       '  // console.log(gpt)\n' +
[1]       '}\n',
[1]     patch: '@@ -1,5 +1,5 @@\n' +
[1]       " // import { updateInstances } from './logic/update-instances'\n" +
[1]       "-// import { github } from './services/github'\n" +
[1]       "+import { GithubApi } from './services/github-api'\n" +
[1]       " // import { gpt } from './services/gpt'\n" +
[1]       " import { checkEnv } from './logic/check-env'\n" +
[1]       ' \n' +
[1]       '@@ -8,6 +8,21 @@ export const main = async () => {\n' +
[1]       ' \n' +
[1]       "   console.log('Hello World')\n" +
[1]       ' \n' +
[1]       '+  const ghAppClientSecret = process.env.GH_APP_CLIENT_SECRET\n' +
[1]       '+  const ghApi = new GithubApi({\n' +
[1]       "+    repoName: 'reviewer',\n" +
[1]       "+    repoOwner: 'webbertakken',\n" +
[1]       "+    installationId: '39090441',\n" +
[1]       "+    appId: '353840',\n" +
[1]       "+    privateKey: ghAppClientSecret || '',\n" +
[1]       '+  })\n' +
[1]       '+\n' +
[1]       '+  try {\n' +
[1]       '+    const result = await ghApi.getFileChanges(4)\n' +
[1]       '+    console.log(result)\n' +
[1]       '+  } catch (error) {\n' +
[1]       "+    console.error('Error fetching pull request information:', error)\n" +
[1]       '+  }\n' +
[1]       '   // List instances\n' +
[1]       '   // await updateInstances(github)\n' +
[1]       '   // console.log(gpt)',
[1]     ignored: false
[1]   },
[1]   {

Checklist