diff --git a/payloads/pull_request_review_comment/created.json b/payloads/pull_request_review_comment/created.json new file mode 100644 index 00000000..ead56fe7 --- /dev/null +++ b/payloads/pull_request_review_comment/created.json @@ -0,0 +1,570 @@ +{ + "action": "created", + "comment": { + "url": "https://api.github.com/repos/gitautoai/website/pulls/comments/1901618546", + "pull_request_review_id": 2528800525, + "id": 1901618546, + "node_id": "PRRC_kwDOLZEVQc5xWGVy", + "diff_hunk": "@@ -0,0 +1,34 @@\n+name: Generate Sitemap\n+\n+on:\n+ push:\n+ branches:\n+ - main\n+ workflow_dispatch:\n+\n+jobs:\n+ build:\n+ runs-on: ubuntu-latest\n+\n+ steps:\n+ - name: Checkout code\n+ uses: actions/checkout@v2\n+\n+ - name: Setup Node.js\n+ uses: actions/setup-node@v2\n+ with:\n+ node-version: '16'\n+\n+ - name: Install dependencies\n+ run: npm install\n+\n+ - name: Generate Sitemap\n+ run: npx next-sitemap", + "path": ".github/workflows/generate-sitemap.yml", + "commit_id": "525196a41789c31422b84be93760ee89d9a7854b", + "original_commit_id": "525196a41789c31422b84be93760ee89d9a7854b", + "user": { + "login": "hiroshinishio", + "id": 4620828, + "node_id": "MDQ6VXNlcjQ2MjA4Mjg=", + "avatar_url": "https://avatars.githubusercontent.com/u/4620828?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hiroshinishio", + "html_url": "https://github.com/hiroshinishio", + "followers_url": "https://api.github.com/users/hiroshinishio/followers", + "following_url": "https://api.github.com/users/hiroshinishio/following{/other_user}", + "gists_url": "https://api.github.com/users/hiroshinishio/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hiroshinishio/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hiroshinishio/subscriptions", + "organizations_url": "https://api.github.com/users/hiroshinishio/orgs", + "repos_url": "https://api.github.com/users/hiroshinishio/repos", + "events_url": "https://api.github.com/users/hiroshinishio/events{/privacy}", + "received_events_url": "https://api.github.com/users/hiroshinishio/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "body": "Why don't you install next-sitemap before this step rather than installing it in package.json? ", + "created_at": "2025-01-03T09:44:56Z", + "updated_at": "2025-01-03T09:46:13Z", + "html_url": "https://github.com/gitautoai/website/pull/169#discussion_r1901618546", + "pull_request_url": "https://api.github.com/repos/gitautoai/website/pulls/169", + "author_association": "CONTRIBUTOR", + "_links": { + "self": { + "href": "https://api.github.com/repos/gitautoai/website/pulls/comments/1901618546" + }, + "html": { + "href": "https://github.com/gitautoai/website/pull/169#discussion_r1901618546" + }, + "pull_request": { + "href": "https://api.github.com/repos/gitautoai/website/pulls/169" + } + }, + "reactions": { + "url": "https://api.github.com/repos/gitautoai/website/pulls/comments/1901618546/reactions", + "total_count": 0, + "+1": 0, + "-1": 0, + "laugh": 0, + "hooray": 0, + "confused": 0, + "heart": 0, + "rocket": 0, + "eyes": 0 + }, + "start_line": null, + "original_start_line": null, + "start_side": null, + "line": 26, + "original_line": 26, + "side": "RIGHT", + "original_position": 26, + "position": 26, + "subject_type": "line" + }, + "pull_request": { + "url": "https://api.github.com/repos/gitautoai/website/pulls/169", + "id": 2256898888, + "node_id": "PR_kwDOLZEVQc6GhYtI", + "html_url": "https://github.com/gitautoai/website/pull/169", + "diff_url": "https://github.com/gitautoai/website/pull/169.diff", + "patch_url": "https://github.com/gitautoai/website/pull/169.patch", + "issue_url": "https://api.github.com/repos/gitautoai/website/issues/169", + "number": 169, + "state": "open", + "locked": false, + "title": "GitAuto: Make our sitemap dynamic by automatically including each page on GitHub actions", + "user": { + "login": "gitauto-for-dev[bot]", + "id": 160085510, + "node_id": "BOT_kgDOCYq2Bg", + "avatar_url": "https://avatars.githubusercontent.com/in/828792?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gitauto-for-dev%5Bbot%5D", + "html_url": "https://github.com/apps/gitauto-for-dev", + "followers_url": "https://api.github.com/users/gitauto-for-dev%5Bbot%5D/followers", + "following_url": "https://api.github.com/users/gitauto-for-dev%5Bbot%5D/following{/other_user}", + "gists_url": "https://api.github.com/users/gitauto-for-dev%5Bbot%5D/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gitauto-for-dev%5Bbot%5D/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gitauto-for-dev%5Bbot%5D/subscriptions", + "organizations_url": "https://api.github.com/users/gitauto-for-dev%5Bbot%5D/orgs", + "repos_url": "https://api.github.com/users/gitauto-for-dev%5Bbot%5D/repos", + "events_url": "https://api.github.com/users/gitauto-for-dev%5Bbot%5D/events{/privacy}", + "received_events_url": "https://api.github.com/users/gitauto-for-dev%5Bbot%5D/received_events", + "type": "Bot", + "user_view_type": "public", + "site_admin": false + }, + "body": "Resolves #167\n\n## What is the feature\n\nImplement a dynamic sitemap generation process that automatically includes each page of the website using GitHub Actions. This ensures that the sitemap is always up-to-date with the latest pages without manual intervention.\n\n## Where / How to code and why\n\n1. **Add a GitHub Actions Workflow for Sitemap Generation**:\n - **File to Create**: `.github/workflows/generate-sitemap.yml`\n - **Reason**: Automating sitemap generation ensures that any new pages added to the website are automatically included in the sitemap without requiring manual updates. This reduces the risk of outdated sitemaps and improves SEO.\n\n2. **Use a Sitemap Generation Tool**:\n - **Implementation**: Utilize a tool like `next-sitemap` or a custom script within the GitHub Actions workflow to scan the project's pages and generate the `sitemap.xml` file.\n - **Reason**: Leveraging existing tools ensures reliability and reduces the complexity of maintaining custom scripts.\n\n3. **Commit and Push the Updated Sitemap**:\n - **Configuration**: Configure the GitHub Action to commit the newly generated `sitemap.xml` back to the repository, preferably to the `main` branch or the branch being deployed.\n - **Reason**: Ensuring that the latest `sitemap.xml` is always part of the repository allows deployment processes to include the updated sitemap automatically.\n\n4. **Update the Deployment Process if Necessary**:\n - **Files to Modify**: Deployment scripts or configurations within `.github/workflows/` if the sitemap needs to be part of the deployment artifacts.\n - **Reason**: To ensure that the deployment process utilizes the newly generated sitemap without conflicts or omissions.\n\n5. **Ensure Proper Permissions for GitHub Actions**:\n - **Configuration**: Update repository settings or GitHub Actions permissions to allow the workflow to commit changes.\n - **Reason**: The workflow needs the necessary permissions to push changes to the repository.\n\n**Migration Guide**:\n- No breaking changes are introduced. However, ensure that the new GitHub Actions workflow does not conflict with existing workflows.\n\n## Anything the issuer needs to do\n\nNo action required.\n\n\n## Test these changes locally\n\n```\ngit fetch origin\ngit checkout gitauto-wes/issue-167-20250101-155924\ngit pull origin gitauto-wes/issue-167-20250101-155924\n```", + "created_at": "2025-01-01T07:01:59Z", + "updated_at": "2025-01-03T09:46:13Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "0b5bf6d1c2a72945ae07acb895177bb667bde1b1", + "assignee": null, + "assignees": [], + "requested_reviewers": [], + "requested_teams": [], + "labels": [], + "milestone": null, + "draft": false, + "commits_url": "https://api.github.com/repos/gitautoai/website/pulls/169/commits", + "review_comments_url": "https://api.github.com/repos/gitautoai/website/pulls/169/comments", + "review_comment_url": "https://api.github.com/repos/gitautoai/website/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/gitautoai/website/issues/169/comments", + "statuses_url": "https://api.github.com/repos/gitautoai/website/statuses/525196a41789c31422b84be93760ee89d9a7854b", + "head": { + "label": "gitautoai:gitauto-wes/issue-167-20250101-155924", + "ref": "gitauto-wes/issue-167-20250101-155924", + "sha": "525196a41789c31422b84be93760ee89d9a7854b", + "user": { + "login": "gitautoai", + "id": 159883862, + "node_id": "O_kgDOCYeiVg", + "avatar_url": "https://avatars.githubusercontent.com/u/159883862?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gitautoai", + "html_url": "https://github.com/gitautoai", + "followers_url": "https://api.github.com/users/gitautoai/followers", + "following_url": "https://api.github.com/users/gitautoai/following{/other_user}", + "gists_url": "https://api.github.com/users/gitautoai/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gitautoai/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gitautoai/subscriptions", + "organizations_url": "https://api.github.com/users/gitautoai/orgs", + "repos_url": "https://api.github.com/users/gitautoai/repos", + "events_url": "https://api.github.com/users/gitautoai/events{/privacy}", + "received_events_url": "https://api.github.com/users/gitautoai/received_events", + "type": "Organization", + "user_view_type": "public", + "site_admin": false + }, + "repo": { + "id": 764482881, + "node_id": "R_kgDOLZEVQQ", + "name": "website", + "full_name": "gitautoai/website", + "private": true, + "owner": { + "login": "gitautoai", + "id": 159883862, + "node_id": "O_kgDOCYeiVg", + "avatar_url": "https://avatars.githubusercontent.com/u/159883862?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gitautoai", + "html_url": "https://github.com/gitautoai", + "followers_url": "https://api.github.com/users/gitautoai/followers", + "following_url": "https://api.github.com/users/gitautoai/following{/other_user}", + "gists_url": "https://api.github.com/users/gitautoai/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gitautoai/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gitautoai/subscriptions", + "organizations_url": "https://api.github.com/users/gitautoai/orgs", + "repos_url": "https://api.github.com/users/gitautoai/repos", + "events_url": "https://api.github.com/users/gitautoai/events{/privacy}", + "received_events_url": "https://api.github.com/users/gitautoai/received_events", + "type": "Organization", + "user_view_type": "public", + "site_admin": false + }, + "html_url": "https://github.com/gitautoai/website", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/gitautoai/website", + "forks_url": "https://api.github.com/repos/gitautoai/website/forks", + "keys_url": "https://api.github.com/repos/gitautoai/website/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/gitautoai/website/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/gitautoai/website/teams", + "hooks_url": "https://api.github.com/repos/gitautoai/website/hooks", + "issue_events_url": "https://api.github.com/repos/gitautoai/website/issues/events{/number}", + "events_url": "https://api.github.com/repos/gitautoai/website/events", + "assignees_url": "https://api.github.com/repos/gitautoai/website/assignees{/user}", + "branches_url": "https://api.github.com/repos/gitautoai/website/branches{/branch}", + "tags_url": "https://api.github.com/repos/gitautoai/website/tags", + "blobs_url": "https://api.github.com/repos/gitautoai/website/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/gitautoai/website/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/gitautoai/website/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/gitautoai/website/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/gitautoai/website/statuses/{sha}", + "languages_url": "https://api.github.com/repos/gitautoai/website/languages", + "stargazers_url": "https://api.github.com/repos/gitautoai/website/stargazers", + "contributors_url": "https://api.github.com/repos/gitautoai/website/contributors", + "subscribers_url": "https://api.github.com/repos/gitautoai/website/subscribers", + "subscription_url": "https://api.github.com/repos/gitautoai/website/subscription", + "commits_url": "https://api.github.com/repos/gitautoai/website/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/gitautoai/website/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/gitautoai/website/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/gitautoai/website/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/gitautoai/website/contents/{+path}", + "compare_url": "https://api.github.com/repos/gitautoai/website/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/gitautoai/website/merges", + "archive_url": "https://api.github.com/repos/gitautoai/website/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/gitautoai/website/downloads", + "issues_url": "https://api.github.com/repos/gitautoai/website/issues{/number}", + "pulls_url": "https://api.github.com/repos/gitautoai/website/pulls{/number}", + "milestones_url": "https://api.github.com/repos/gitautoai/website/milestones{/number}", + "notifications_url": "https://api.github.com/repos/gitautoai/website/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/gitautoai/website/labels{/name}", + "releases_url": "https://api.github.com/repos/gitautoai/website/releases{/id}", + "deployments_url": "https://api.github.com/repos/gitautoai/website/deployments", + "created_at": "2024-02-28T06:43:00Z", + "updated_at": "2025-01-01T15:04:47Z", + "pushed_at": "2025-01-03T09:40:10Z", + "git_url": "git://github.com/gitautoai/website.git", + "ssh_url": "git@github.com:gitautoai/website.git", + "clone_url": "https://github.com/gitautoai/website.git", + "svn_url": "https://github.com/gitautoai/website", + "homepage": "https://gitauto.ai", + "size": 68502, + "stargazers_count": 1, + "watchers_count": 1, + "language": "TypeScript", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 12, + "license": null, + "allow_forking": false, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "private", + "forks": 0, + "open_issues": 12, + "watchers": 1, + "default_branch": "main", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": true, + "allow_update_branch": true, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "base": { + "label": "gitautoai:main", + "ref": "main", + "sha": "868abf1ea8841e21d52aa11558bbdd008b02a7ee", + "user": { + "login": "gitautoai", + "id": 159883862, + "node_id": "O_kgDOCYeiVg", + "avatar_url": "https://avatars.githubusercontent.com/u/159883862?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gitautoai", + "html_url": "https://github.com/gitautoai", + "followers_url": "https://api.github.com/users/gitautoai/followers", + "following_url": "https://api.github.com/users/gitautoai/following{/other_user}", + "gists_url": "https://api.github.com/users/gitautoai/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gitautoai/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gitautoai/subscriptions", + "organizations_url": "https://api.github.com/users/gitautoai/orgs", + "repos_url": "https://api.github.com/users/gitautoai/repos", + "events_url": "https://api.github.com/users/gitautoai/events{/privacy}", + "received_events_url": "https://api.github.com/users/gitautoai/received_events", + "type": "Organization", + "user_view_type": "public", + "site_admin": false + }, + "repo": { + "id": 764482881, + "node_id": "R_kgDOLZEVQQ", + "name": "website", + "full_name": "gitautoai/website", + "private": true, + "owner": { + "login": "gitautoai", + "id": 159883862, + "node_id": "O_kgDOCYeiVg", + "avatar_url": "https://avatars.githubusercontent.com/u/159883862?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gitautoai", + "html_url": "https://github.com/gitautoai", + "followers_url": "https://api.github.com/users/gitautoai/followers", + "following_url": "https://api.github.com/users/gitautoai/following{/other_user}", + "gists_url": "https://api.github.com/users/gitautoai/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gitautoai/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gitautoai/subscriptions", + "organizations_url": "https://api.github.com/users/gitautoai/orgs", + "repos_url": "https://api.github.com/users/gitautoai/repos", + "events_url": "https://api.github.com/users/gitautoai/events{/privacy}", + "received_events_url": "https://api.github.com/users/gitautoai/received_events", + "type": "Organization", + "user_view_type": "public", + "site_admin": false + }, + "html_url": "https://github.com/gitautoai/website", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/gitautoai/website", + "forks_url": "https://api.github.com/repos/gitautoai/website/forks", + "keys_url": "https://api.github.com/repos/gitautoai/website/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/gitautoai/website/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/gitautoai/website/teams", + "hooks_url": "https://api.github.com/repos/gitautoai/website/hooks", + "issue_events_url": "https://api.github.com/repos/gitautoai/website/issues/events{/number}", + "events_url": "https://api.github.com/repos/gitautoai/website/events", + "assignees_url": "https://api.github.com/repos/gitautoai/website/assignees{/user}", + "branches_url": "https://api.github.com/repos/gitautoai/website/branches{/branch}", + "tags_url": "https://api.github.com/repos/gitautoai/website/tags", + "blobs_url": "https://api.github.com/repos/gitautoai/website/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/gitautoai/website/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/gitautoai/website/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/gitautoai/website/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/gitautoai/website/statuses/{sha}", + "languages_url": "https://api.github.com/repos/gitautoai/website/languages", + "stargazers_url": "https://api.github.com/repos/gitautoai/website/stargazers", + "contributors_url": "https://api.github.com/repos/gitautoai/website/contributors", + "subscribers_url": "https://api.github.com/repos/gitautoai/website/subscribers", + "subscription_url": "https://api.github.com/repos/gitautoai/website/subscription", + "commits_url": "https://api.github.com/repos/gitautoai/website/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/gitautoai/website/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/gitautoai/website/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/gitautoai/website/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/gitautoai/website/contents/{+path}", + "compare_url": "https://api.github.com/repos/gitautoai/website/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/gitautoai/website/merges", + "archive_url": "https://api.github.com/repos/gitautoai/website/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/gitautoai/website/downloads", + "issues_url": "https://api.github.com/repos/gitautoai/website/issues{/number}", + "pulls_url": "https://api.github.com/repos/gitautoai/website/pulls{/number}", + "milestones_url": "https://api.github.com/repos/gitautoai/website/milestones{/number}", + "notifications_url": "https://api.github.com/repos/gitautoai/website/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/gitautoai/website/labels{/name}", + "releases_url": "https://api.github.com/repos/gitautoai/website/releases{/id}", + "deployments_url": "https://api.github.com/repos/gitautoai/website/deployments", + "created_at": "2024-02-28T06:43:00Z", + "updated_at": "2025-01-01T15:04:47Z", + "pushed_at": "2025-01-03T09:40:10Z", + "git_url": "git://github.com/gitautoai/website.git", + "ssh_url": "git@github.com:gitautoai/website.git", + "clone_url": "https://github.com/gitautoai/website.git", + "svn_url": "https://github.com/gitautoai/website", + "homepage": "https://gitauto.ai", + "size": 68502, + "stargazers_count": 1, + "watchers_count": 1, + "language": "TypeScript", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 12, + "license": null, + "allow_forking": false, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "private", + "forks": 0, + "open_issues": 12, + "watchers": 1, + "default_branch": "main", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": true, + "allow_update_branch": true, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/gitautoai/website/pulls/169" + }, + "html": { + "href": "https://github.com/gitautoai/website/pull/169" + }, + "issue": { + "href": "https://api.github.com/repos/gitautoai/website/issues/169" + }, + "comments": { + "href": "https://api.github.com/repos/gitautoai/website/issues/169/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/gitautoai/website/pulls/169/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/gitautoai/website/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/gitautoai/website/pulls/169/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/gitautoai/website/statuses/525196a41789c31422b84be93760ee89d9a7854b" + } + }, + "author_association": "NONE", + "auto_merge": null, + "active_lock_reason": null + }, + "repository": { + "id": 764482881, + "node_id": "R_kgDOLZEVQQ", + "name": "website", + "full_name": "gitautoai/website", + "private": true, + "owner": { + "login": "gitautoai", + "id": 159883862, + "node_id": "O_kgDOCYeiVg", + "avatar_url": "https://avatars.githubusercontent.com/u/159883862?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gitautoai", + "html_url": "https://github.com/gitautoai", + "followers_url": "https://api.github.com/users/gitautoai/followers", + "following_url": "https://api.github.com/users/gitautoai/following{/other_user}", + "gists_url": "https://api.github.com/users/gitautoai/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gitautoai/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gitautoai/subscriptions", + "organizations_url": "https://api.github.com/users/gitautoai/orgs", + "repos_url": "https://api.github.com/users/gitautoai/repos", + "events_url": "https://api.github.com/users/gitautoai/events{/privacy}", + "received_events_url": "https://api.github.com/users/gitautoai/received_events", + "type": "Organization", + "user_view_type": "public", + "site_admin": false + }, + "html_url": "https://github.com/gitautoai/website", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/gitautoai/website", + "forks_url": "https://api.github.com/repos/gitautoai/website/forks", + "keys_url": "https://api.github.com/repos/gitautoai/website/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/gitautoai/website/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/gitautoai/website/teams", + "hooks_url": "https://api.github.com/repos/gitautoai/website/hooks", + "issue_events_url": "https://api.github.com/repos/gitautoai/website/issues/events{/number}", + "events_url": "https://api.github.com/repos/gitautoai/website/events", + "assignees_url": "https://api.github.com/repos/gitautoai/website/assignees{/user}", + "branches_url": "https://api.github.com/repos/gitautoai/website/branches{/branch}", + "tags_url": "https://api.github.com/repos/gitautoai/website/tags", + "blobs_url": "https://api.github.com/repos/gitautoai/website/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/gitautoai/website/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/gitautoai/website/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/gitautoai/website/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/gitautoai/website/statuses/{sha}", + "languages_url": "https://api.github.com/repos/gitautoai/website/languages", + "stargazers_url": "https://api.github.com/repos/gitautoai/website/stargazers", + "contributors_url": "https://api.github.com/repos/gitautoai/website/contributors", + "subscribers_url": "https://api.github.com/repos/gitautoai/website/subscribers", + "subscription_url": "https://api.github.com/repos/gitautoai/website/subscription", + "commits_url": "https://api.github.com/repos/gitautoai/website/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/gitautoai/website/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/gitautoai/website/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/gitautoai/website/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/gitautoai/website/contents/{+path}", + "compare_url": "https://api.github.com/repos/gitautoai/website/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/gitautoai/website/merges", + "archive_url": "https://api.github.com/repos/gitautoai/website/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/gitautoai/website/downloads", + "issues_url": "https://api.github.com/repos/gitautoai/website/issues{/number}", + "pulls_url": "https://api.github.com/repos/gitautoai/website/pulls{/number}", + "milestones_url": "https://api.github.com/repos/gitautoai/website/milestones{/number}", + "notifications_url": "https://api.github.com/repos/gitautoai/website/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/gitautoai/website/labels{/name}", + "releases_url": "https://api.github.com/repos/gitautoai/website/releases{/id}", + "deployments_url": "https://api.github.com/repos/gitautoai/website/deployments", + "created_at": "2024-02-28T06:43:00Z", + "updated_at": "2025-01-01T15:04:47Z", + "pushed_at": "2025-01-03T09:40:10Z", + "git_url": "git://github.com/gitautoai/website.git", + "ssh_url": "git@github.com:gitautoai/website.git", + "clone_url": "https://github.com/gitautoai/website.git", + "svn_url": "https://github.com/gitautoai/website", + "homepage": "https://gitauto.ai", + "size": 68502, + "stargazers_count": 1, + "watchers_count": 1, + "language": "TypeScript", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 12, + "license": null, + "allow_forking": false, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "private", + "forks": 0, + "open_issues": 12, + "watchers": 1, + "default_branch": "main", + "custom_properties": {} + }, + "organization": { + "login": "gitautoai", + "id": 159883862, + "node_id": "O_kgDOCYeiVg", + "url": "https://api.github.com/orgs/gitautoai", + "repos_url": "https://api.github.com/orgs/gitautoai/repos", + "events_url": "https://api.github.com/orgs/gitautoai/events", + "hooks_url": "https://api.github.com/orgs/gitautoai/hooks", + "issues_url": "https://api.github.com/orgs/gitautoai/issues", + "members_url": "https://api.github.com/orgs/gitautoai/members{/member}", + "public_members_url": "https://api.github.com/orgs/gitautoai/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/159883862?v=4", + "description": "GitAuto, an AI coding agent, helps engineering teams facing resource constraints and hiring challenges fix more bugs and ship more features." + }, + "sender": { + "login": "hiroshinishio", + "id": 4620828, + "node_id": "MDQ6VXNlcjQ2MjA4Mjg=", + "avatar_url": "https://avatars.githubusercontent.com/u/4620828?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hiroshinishio", + "html_url": "https://github.com/hiroshinishio", + "followers_url": "https://api.github.com/users/hiroshinishio/followers", + "following_url": "https://api.github.com/users/hiroshinishio/following{/other_user}", + "gists_url": "https://api.github.com/users/hiroshinishio/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hiroshinishio/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hiroshinishio/subscriptions", + "organizations_url": "https://api.github.com/users/hiroshinishio/orgs", + "repos_url": "https://api.github.com/users/hiroshinishio/repos", + "events_url": "https://api.github.com/users/hiroshinishio/events{/privacy}", + "received_events_url": "https://api.github.com/users/hiroshinishio/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "installation": { + "id": 53743403, + "node_id": "MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uNTM3NDM0MDM=" + } +} \ No newline at end of file diff --git a/payloads/pull_request_review_comment/edited.json b/payloads/pull_request_review_comment/edited.json new file mode 100644 index 00000000..416f5f0c --- /dev/null +++ b/payloads/pull_request_review_comment/edited.json @@ -0,0 +1,575 @@ +{ + "action": "edited", + "changes": { + "body": { + "from": "To begin with, if we run next-sitemap on github actions then I don't think we need next-sitemap in package.json" + } + }, + "comment": { + "url": "https://api.github.com/repos/gitautoai/website/pulls/comments/1900634503", + "pull_request_review_id": 2527173539, + "id": 1900634503, + "node_id": "PRRC_kwDOLZEVQc5xSWGH", + "diff_hunk": "", + "path": "package.json", + "commit_id": "6172c7ab38399e3fcc3c74aebb9d513a7a1daff8", + "original_commit_id": "6172c7ab38399e3fcc3c74aebb9d513a7a1daff8", + "user": { + "login": "hiroshinishio", + "id": 4620828, + "node_id": "MDQ6VXNlcjQ2MjA4Mjg=", + "avatar_url": "https://avatars.githubusercontent.com/u/4620828?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hiroshinishio", + "html_url": "https://github.com/hiroshinishio", + "followers_url": "https://api.github.com/users/hiroshinishio/followers", + "following_url": "https://api.github.com/users/hiroshinishio/following{/other_user}", + "gists_url": "https://api.github.com/users/hiroshinishio/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hiroshinishio/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hiroshinishio/subscriptions", + "organizations_url": "https://api.github.com/users/hiroshinishio/orgs", + "repos_url": "https://api.github.com/users/hiroshinishio/repos", + "events_url": "https://api.github.com/users/hiroshinishio/events{/privacy}", + "received_events_url": "https://api.github.com/users/hiroshinishio/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "body": "To begin with, if we run next-sitemap on github actions then I don't think we need next-sitemap in package.json.", + "created_at": "2025-01-02T08:22:25Z", + "updated_at": "2025-01-02T08:31:49Z", + "html_url": "https://github.com/gitautoai/website/pull/169#discussion_r1900634503", + "pull_request_url": "https://api.github.com/repos/gitautoai/website/pulls/169", + "author_association": "CONTRIBUTOR", + "_links": { + "self": { + "href": "https://api.github.com/repos/gitautoai/website/pulls/comments/1900634503" + }, + "html": { + "href": "https://github.com/gitautoai/website/pull/169#discussion_r1900634503" + }, + "pull_request": { + "href": "https://api.github.com/repos/gitautoai/website/pulls/169" + } + }, + "reactions": { + "url": "https://api.github.com/repos/gitautoai/website/pulls/comments/1900634503/reactions", + "total_count": 0, + "+1": 0, + "-1": 0, + "laugh": 0, + "hooray": 0, + "confused": 0, + "heart": 0, + "rocket": 0, + "eyes": 0 + }, + "start_line": null, + "original_start_line": null, + "start_side": null, + "line": 1, + "original_line": 1, + "side": "RIGHT", + "original_position": 1, + "position": 1, + "subject_type": "file" + }, + "pull_request": { + "url": "https://api.github.com/repos/gitautoai/website/pulls/169", + "id": 2256898888, + "node_id": "PR_kwDOLZEVQc6GhYtI", + "html_url": "https://github.com/gitautoai/website/pull/169", + "diff_url": "https://github.com/gitautoai/website/pull/169.diff", + "patch_url": "https://github.com/gitautoai/website/pull/169.patch", + "issue_url": "https://api.github.com/repos/gitautoai/website/issues/169", + "number": 169, + "state": "open", + "locked": false, + "title": "GitAuto: Make our sitemap dynamic by automatically including each page on GitHub actions", + "user": { + "login": "gitauto-for-dev[bot]", + "id": 160085510, + "node_id": "BOT_kgDOCYq2Bg", + "avatar_url": "https://avatars.githubusercontent.com/in/828792?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gitauto-for-dev%5Bbot%5D", + "html_url": "https://github.com/apps/gitauto-for-dev", + "followers_url": "https://api.github.com/users/gitauto-for-dev%5Bbot%5D/followers", + "following_url": "https://api.github.com/users/gitauto-for-dev%5Bbot%5D/following{/other_user}", + "gists_url": "https://api.github.com/users/gitauto-for-dev%5Bbot%5D/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gitauto-for-dev%5Bbot%5D/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gitauto-for-dev%5Bbot%5D/subscriptions", + "organizations_url": "https://api.github.com/users/gitauto-for-dev%5Bbot%5D/orgs", + "repos_url": "https://api.github.com/users/gitauto-for-dev%5Bbot%5D/repos", + "events_url": "https://api.github.com/users/gitauto-for-dev%5Bbot%5D/events{/privacy}", + "received_events_url": "https://api.github.com/users/gitauto-for-dev%5Bbot%5D/received_events", + "type": "Bot", + "user_view_type": "public", + "site_admin": false + }, + "body": "Resolves #167\n\n## What is the feature\n\nImplement a dynamic sitemap generation process that automatically includes each page of the website using GitHub Actions. This ensures that the sitemap is always up-to-date with the latest pages without manual intervention.\n\n## Where / How to code and why\n\n1. **Add a GitHub Actions Workflow for Sitemap Generation**:\n - **File to Create**: `.github/workflows/generate-sitemap.yml`\n - **Reason**: Automating sitemap generation ensures that any new pages added to the website are automatically included in the sitemap without requiring manual updates. This reduces the risk of outdated sitemaps and improves SEO.\n\n2. **Use a Sitemap Generation Tool**:\n - **Implementation**: Utilize a tool like `next-sitemap` or a custom script within the GitHub Actions workflow to scan the project's pages and generate the `sitemap.xml` file.\n - **Reason**: Leveraging existing tools ensures reliability and reduces the complexity of maintaining custom scripts.\n\n3. **Commit and Push the Updated Sitemap**:\n - **Configuration**: Configure the GitHub Action to commit the newly generated `sitemap.xml` back to the repository, preferably to the `main` branch or the branch being deployed.\n - **Reason**: Ensuring that the latest `sitemap.xml` is always part of the repository allows deployment processes to include the updated sitemap automatically.\n\n4. **Update the Deployment Process if Necessary**:\n - **Files to Modify**: Deployment scripts or configurations within `.github/workflows/` if the sitemap needs to be part of the deployment artifacts.\n - **Reason**: To ensure that the deployment process utilizes the newly generated sitemap without conflicts or omissions.\n\n5. **Ensure Proper Permissions for GitHub Actions**:\n - **Configuration**: Update repository settings or GitHub Actions permissions to allow the workflow to commit changes.\n - **Reason**: The workflow needs the necessary permissions to push changes to the repository.\n\n**Migration Guide**:\n- No breaking changes are introduced. However, ensure that the new GitHub Actions workflow does not conflict with existing workflows.\n\n## Anything the issuer needs to do\n\nNo action required.\n\n\n## Test these changes locally\n\n```\ngit fetch origin\ngit checkout gitauto-wes/issue-167-20250101-155924\ngit pull origin gitauto-wes/issue-167-20250101-155924\n```", + "created_at": "2025-01-01T07:01:59Z", + "updated_at": "2025-01-02T08:22:40Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "9aae9b3d730c2d98f3bea5c9afe8567923a1354c", + "assignee": null, + "assignees": [], + "requested_reviewers": [], + "requested_teams": [], + "labels": [], + "milestone": null, + "draft": false, + "commits_url": "https://api.github.com/repos/gitautoai/website/pulls/169/commits", + "review_comments_url": "https://api.github.com/repos/gitautoai/website/pulls/169/comments", + "review_comment_url": "https://api.github.com/repos/gitautoai/website/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/gitautoai/website/issues/169/comments", + "statuses_url": "https://api.github.com/repos/gitautoai/website/statuses/6172c7ab38399e3fcc3c74aebb9d513a7a1daff8", + "head": { + "label": "gitautoai:gitauto-wes/issue-167-20250101-155924", + "ref": "gitauto-wes/issue-167-20250101-155924", + "sha": "6172c7ab38399e3fcc3c74aebb9d513a7a1daff8", + "user": { + "login": "gitautoai", + "id": 159883862, + "node_id": "O_kgDOCYeiVg", + "avatar_url": "https://avatars.githubusercontent.com/u/159883862?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gitautoai", + "html_url": "https://github.com/gitautoai", + "followers_url": "https://api.github.com/users/gitautoai/followers", + "following_url": "https://api.github.com/users/gitautoai/following{/other_user}", + "gists_url": "https://api.github.com/users/gitautoai/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gitautoai/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gitautoai/subscriptions", + "organizations_url": "https://api.github.com/users/gitautoai/orgs", + "repos_url": "https://api.github.com/users/gitautoai/repos", + "events_url": "https://api.github.com/users/gitautoai/events{/privacy}", + "received_events_url": "https://api.github.com/users/gitautoai/received_events", + "type": "Organization", + "user_view_type": "public", + "site_admin": false + }, + "repo": { + "id": 764482881, + "node_id": "R_kgDOLZEVQQ", + "name": "website", + "full_name": "gitautoai/website", + "private": true, + "owner": { + "login": "gitautoai", + "id": 159883862, + "node_id": "O_kgDOCYeiVg", + "avatar_url": "https://avatars.githubusercontent.com/u/159883862?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gitautoai", + "html_url": "https://github.com/gitautoai", + "followers_url": "https://api.github.com/users/gitautoai/followers", + "following_url": "https://api.github.com/users/gitautoai/following{/other_user}", + "gists_url": "https://api.github.com/users/gitautoai/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gitautoai/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gitautoai/subscriptions", + "organizations_url": "https://api.github.com/users/gitautoai/orgs", + "repos_url": "https://api.github.com/users/gitautoai/repos", + "events_url": "https://api.github.com/users/gitautoai/events{/privacy}", + "received_events_url": "https://api.github.com/users/gitautoai/received_events", + "type": "Organization", + "user_view_type": "public", + "site_admin": false + }, + "html_url": "https://github.com/gitautoai/website", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/gitautoai/website", + "forks_url": "https://api.github.com/repos/gitautoai/website/forks", + "keys_url": "https://api.github.com/repos/gitautoai/website/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/gitautoai/website/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/gitautoai/website/teams", + "hooks_url": "https://api.github.com/repos/gitautoai/website/hooks", + "issue_events_url": "https://api.github.com/repos/gitautoai/website/issues/events{/number}", + "events_url": "https://api.github.com/repos/gitautoai/website/events", + "assignees_url": "https://api.github.com/repos/gitautoai/website/assignees{/user}", + "branches_url": "https://api.github.com/repos/gitautoai/website/branches{/branch}", + "tags_url": "https://api.github.com/repos/gitautoai/website/tags", + "blobs_url": "https://api.github.com/repos/gitautoai/website/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/gitautoai/website/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/gitautoai/website/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/gitautoai/website/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/gitautoai/website/statuses/{sha}", + "languages_url": "https://api.github.com/repos/gitautoai/website/languages", + "stargazers_url": "https://api.github.com/repos/gitautoai/website/stargazers", + "contributors_url": "https://api.github.com/repos/gitautoai/website/contributors", + "subscribers_url": "https://api.github.com/repos/gitautoai/website/subscribers", + "subscription_url": "https://api.github.com/repos/gitautoai/website/subscription", + "commits_url": "https://api.github.com/repos/gitautoai/website/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/gitautoai/website/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/gitautoai/website/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/gitautoai/website/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/gitautoai/website/contents/{+path}", + "compare_url": "https://api.github.com/repos/gitautoai/website/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/gitautoai/website/merges", + "archive_url": "https://api.github.com/repos/gitautoai/website/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/gitautoai/website/downloads", + "issues_url": "https://api.github.com/repos/gitautoai/website/issues{/number}", + "pulls_url": "https://api.github.com/repos/gitautoai/website/pulls{/number}", + "milestones_url": "https://api.github.com/repos/gitautoai/website/milestones{/number}", + "notifications_url": "https://api.github.com/repos/gitautoai/website/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/gitautoai/website/labels{/name}", + "releases_url": "https://api.github.com/repos/gitautoai/website/releases{/id}", + "deployments_url": "https://api.github.com/repos/gitautoai/website/deployments", + "created_at": "2024-02-28T06:43:00Z", + "updated_at": "2025-01-01T15:04:47Z", + "pushed_at": "2025-01-01T15:04:44Z", + "git_url": "git://github.com/gitautoai/website.git", + "ssh_url": "git@github.com:gitautoai/website.git", + "clone_url": "https://github.com/gitautoai/website.git", + "svn_url": "https://github.com/gitautoai/website", + "homepage": "https://gitauto.ai", + "size": 68502, + "stargazers_count": 1, + "watchers_count": 1, + "language": "TypeScript", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 12, + "license": null, + "allow_forking": false, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "private", + "forks": 0, + "open_issues": 12, + "watchers": 1, + "default_branch": "main", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": true, + "allow_update_branch": true, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "base": { + "label": "gitautoai:main", + "ref": "main", + "sha": "868abf1ea8841e21d52aa11558bbdd008b02a7ee", + "user": { + "login": "gitautoai", + "id": 159883862, + "node_id": "O_kgDOCYeiVg", + "avatar_url": "https://avatars.githubusercontent.com/u/159883862?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gitautoai", + "html_url": "https://github.com/gitautoai", + "followers_url": "https://api.github.com/users/gitautoai/followers", + "following_url": "https://api.github.com/users/gitautoai/following{/other_user}", + "gists_url": "https://api.github.com/users/gitautoai/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gitautoai/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gitautoai/subscriptions", + "organizations_url": "https://api.github.com/users/gitautoai/orgs", + "repos_url": "https://api.github.com/users/gitautoai/repos", + "events_url": "https://api.github.com/users/gitautoai/events{/privacy}", + "received_events_url": "https://api.github.com/users/gitautoai/received_events", + "type": "Organization", + "user_view_type": "public", + "site_admin": false + }, + "repo": { + "id": 764482881, + "node_id": "R_kgDOLZEVQQ", + "name": "website", + "full_name": "gitautoai/website", + "private": true, + "owner": { + "login": "gitautoai", + "id": 159883862, + "node_id": "O_kgDOCYeiVg", + "avatar_url": "https://avatars.githubusercontent.com/u/159883862?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gitautoai", + "html_url": "https://github.com/gitautoai", + "followers_url": "https://api.github.com/users/gitautoai/followers", + "following_url": "https://api.github.com/users/gitautoai/following{/other_user}", + "gists_url": "https://api.github.com/users/gitautoai/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gitautoai/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gitautoai/subscriptions", + "organizations_url": "https://api.github.com/users/gitautoai/orgs", + "repos_url": "https://api.github.com/users/gitautoai/repos", + "events_url": "https://api.github.com/users/gitautoai/events{/privacy}", + "received_events_url": "https://api.github.com/users/gitautoai/received_events", + "type": "Organization", + "user_view_type": "public", + "site_admin": false + }, + "html_url": "https://github.com/gitautoai/website", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/gitautoai/website", + "forks_url": "https://api.github.com/repos/gitautoai/website/forks", + "keys_url": "https://api.github.com/repos/gitautoai/website/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/gitautoai/website/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/gitautoai/website/teams", + "hooks_url": "https://api.github.com/repos/gitautoai/website/hooks", + "issue_events_url": "https://api.github.com/repos/gitautoai/website/issues/events{/number}", + "events_url": "https://api.github.com/repos/gitautoai/website/events", + "assignees_url": "https://api.github.com/repos/gitautoai/website/assignees{/user}", + "branches_url": "https://api.github.com/repos/gitautoai/website/branches{/branch}", + "tags_url": "https://api.github.com/repos/gitautoai/website/tags", + "blobs_url": "https://api.github.com/repos/gitautoai/website/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/gitautoai/website/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/gitautoai/website/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/gitautoai/website/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/gitautoai/website/statuses/{sha}", + "languages_url": "https://api.github.com/repos/gitautoai/website/languages", + "stargazers_url": "https://api.github.com/repos/gitautoai/website/stargazers", + "contributors_url": "https://api.github.com/repos/gitautoai/website/contributors", + "subscribers_url": "https://api.github.com/repos/gitautoai/website/subscribers", + "subscription_url": "https://api.github.com/repos/gitautoai/website/subscription", + "commits_url": "https://api.github.com/repos/gitautoai/website/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/gitautoai/website/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/gitautoai/website/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/gitautoai/website/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/gitautoai/website/contents/{+path}", + "compare_url": "https://api.github.com/repos/gitautoai/website/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/gitautoai/website/merges", + "archive_url": "https://api.github.com/repos/gitautoai/website/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/gitautoai/website/downloads", + "issues_url": "https://api.github.com/repos/gitautoai/website/issues{/number}", + "pulls_url": "https://api.github.com/repos/gitautoai/website/pulls{/number}", + "milestones_url": "https://api.github.com/repos/gitautoai/website/milestones{/number}", + "notifications_url": "https://api.github.com/repos/gitautoai/website/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/gitautoai/website/labels{/name}", + "releases_url": "https://api.github.com/repos/gitautoai/website/releases{/id}", + "deployments_url": "https://api.github.com/repos/gitautoai/website/deployments", + "created_at": "2024-02-28T06:43:00Z", + "updated_at": "2025-01-01T15:04:47Z", + "pushed_at": "2025-01-01T15:04:44Z", + "git_url": "git://github.com/gitautoai/website.git", + "ssh_url": "git@github.com:gitautoai/website.git", + "clone_url": "https://github.com/gitautoai/website.git", + "svn_url": "https://github.com/gitautoai/website", + "homepage": "https://gitauto.ai", + "size": 68502, + "stargazers_count": 1, + "watchers_count": 1, + "language": "TypeScript", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 12, + "license": null, + "allow_forking": false, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "private", + "forks": 0, + "open_issues": 12, + "watchers": 1, + "default_branch": "main", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": true, + "allow_update_branch": true, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/gitautoai/website/pulls/169" + }, + "html": { + "href": "https://github.com/gitautoai/website/pull/169" + }, + "issue": { + "href": "https://api.github.com/repos/gitautoai/website/issues/169" + }, + "comments": { + "href": "https://api.github.com/repos/gitautoai/website/issues/169/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/gitautoai/website/pulls/169/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/gitautoai/website/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/gitautoai/website/pulls/169/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/gitautoai/website/statuses/6172c7ab38399e3fcc3c74aebb9d513a7a1daff8" + } + }, + "author_association": "NONE", + "auto_merge": null, + "active_lock_reason": null + }, + "repository": { + "id": 764482881, + "node_id": "R_kgDOLZEVQQ", + "name": "website", + "full_name": "gitautoai/website", + "private": true, + "owner": { + "login": "gitautoai", + "id": 159883862, + "node_id": "O_kgDOCYeiVg", + "avatar_url": "https://avatars.githubusercontent.com/u/159883862?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gitautoai", + "html_url": "https://github.com/gitautoai", + "followers_url": "https://api.github.com/users/gitautoai/followers", + "following_url": "https://api.github.com/users/gitautoai/following{/other_user}", + "gists_url": "https://api.github.com/users/gitautoai/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gitautoai/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gitautoai/subscriptions", + "organizations_url": "https://api.github.com/users/gitautoai/orgs", + "repos_url": "https://api.github.com/users/gitautoai/repos", + "events_url": "https://api.github.com/users/gitautoai/events{/privacy}", + "received_events_url": "https://api.github.com/users/gitautoai/received_events", + "type": "Organization", + "user_view_type": "public", + "site_admin": false + }, + "html_url": "https://github.com/gitautoai/website", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/gitautoai/website", + "forks_url": "https://api.github.com/repos/gitautoai/website/forks", + "keys_url": "https://api.github.com/repos/gitautoai/website/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/gitautoai/website/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/gitautoai/website/teams", + "hooks_url": "https://api.github.com/repos/gitautoai/website/hooks", + "issue_events_url": "https://api.github.com/repos/gitautoai/website/issues/events{/number}", + "events_url": "https://api.github.com/repos/gitautoai/website/events", + "assignees_url": "https://api.github.com/repos/gitautoai/website/assignees{/user}", + "branches_url": "https://api.github.com/repos/gitautoai/website/branches{/branch}", + "tags_url": "https://api.github.com/repos/gitautoai/website/tags", + "blobs_url": "https://api.github.com/repos/gitautoai/website/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/gitautoai/website/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/gitautoai/website/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/gitautoai/website/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/gitautoai/website/statuses/{sha}", + "languages_url": "https://api.github.com/repos/gitautoai/website/languages", + "stargazers_url": "https://api.github.com/repos/gitautoai/website/stargazers", + "contributors_url": "https://api.github.com/repos/gitautoai/website/contributors", + "subscribers_url": "https://api.github.com/repos/gitautoai/website/subscribers", + "subscription_url": "https://api.github.com/repos/gitautoai/website/subscription", + "commits_url": "https://api.github.com/repos/gitautoai/website/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/gitautoai/website/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/gitautoai/website/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/gitautoai/website/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/gitautoai/website/contents/{+path}", + "compare_url": "https://api.github.com/repos/gitautoai/website/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/gitautoai/website/merges", + "archive_url": "https://api.github.com/repos/gitautoai/website/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/gitautoai/website/downloads", + "issues_url": "https://api.github.com/repos/gitautoai/website/issues{/number}", + "pulls_url": "https://api.github.com/repos/gitautoai/website/pulls{/number}", + "milestones_url": "https://api.github.com/repos/gitautoai/website/milestones{/number}", + "notifications_url": "https://api.github.com/repos/gitautoai/website/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/gitautoai/website/labels{/name}", + "releases_url": "https://api.github.com/repos/gitautoai/website/releases{/id}", + "deployments_url": "https://api.github.com/repos/gitautoai/website/deployments", + "created_at": "2024-02-28T06:43:00Z", + "updated_at": "2025-01-01T15:04:47Z", + "pushed_at": "2025-01-01T15:04:44Z", + "git_url": "git://github.com/gitautoai/website.git", + "ssh_url": "git@github.com:gitautoai/website.git", + "clone_url": "https://github.com/gitautoai/website.git", + "svn_url": "https://github.com/gitautoai/website", + "homepage": "https://gitauto.ai", + "size": 68502, + "stargazers_count": 1, + "watchers_count": 1, + "language": "TypeScript", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 12, + "license": null, + "allow_forking": false, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "private", + "forks": 0, + "open_issues": 12, + "watchers": 1, + "default_branch": "main", + "custom_properties": {} + }, + "organization": { + "login": "gitautoai", + "id": 159883862, + "node_id": "O_kgDOCYeiVg", + "url": "https://api.github.com/orgs/gitautoai", + "repos_url": "https://api.github.com/orgs/gitautoai/repos", + "events_url": "https://api.github.com/orgs/gitautoai/events", + "hooks_url": "https://api.github.com/orgs/gitautoai/hooks", + "issues_url": "https://api.github.com/orgs/gitautoai/issues", + "members_url": "https://api.github.com/orgs/gitautoai/members{/member}", + "public_members_url": "https://api.github.com/orgs/gitautoai/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/159883862?v=4", + "description": "GitAuto, an AI coding agent, helps engineering teams facing resource constraints and hiring challenges fix more bugs and ship more features." + }, + "sender": { + "login": "hiroshinishio", + "id": 4620828, + "node_id": "MDQ6VXNlcjQ2MjA4Mjg=", + "avatar_url": "https://avatars.githubusercontent.com/u/4620828?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hiroshinishio", + "html_url": "https://github.com/hiroshinishio", + "followers_url": "https://api.github.com/users/hiroshinishio/followers", + "following_url": "https://api.github.com/users/hiroshinishio/following{/other_user}", + "gists_url": "https://api.github.com/users/hiroshinishio/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hiroshinishio/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hiroshinishio/subscriptions", + "organizations_url": "https://api.github.com/users/hiroshinishio/orgs", + "repos_url": "https://api.github.com/users/hiroshinishio/repos", + "events_url": "https://api.github.com/users/hiroshinishio/events{/privacy}", + "received_events_url": "https://api.github.com/users/hiroshinishio/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "installation": { + "id": 53743403, + "node_id": "MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uNTM3NDM0MDM=" + } +} \ No newline at end of file diff --git a/services/check_run_handler.py b/services/check_run_handler.py index cdb24df6..3b9cd62f 100644 --- a/services/check_run_handler.py +++ b/services/check_run_handler.py @@ -25,7 +25,7 @@ PullRequest, Repository, ) -from services.github.pulls_manager import get_pull_request, get_pull_request_files +from services.github.pulls_manager import get_pull_request, get_pull_request_file_changes from services.github.github_utils import create_permission_url from services.openai.commit_changes import chat_with_agent from services.openai.chat import chat_with_ai @@ -137,7 +137,7 @@ def handle_check_run(payload: CheckRunCompletedPayload) -> None: update_comment(body=comment_body, base_args=base_args, p=5) pull_title, pull_body = get_pull_request(url=pull_url, token=token) pull_file_url = f"{pull_url}/files" - pull_changes = get_pull_request_files(url=pull_file_url, token=token) + pull_changes = get_pull_request_file_changes(url=pull_file_url, token=token) # Get the GitHub workflow file content comment_body = "Checking out the GitHub Action workflow file..." diff --git a/services/gitauto_handler.py b/services/gitauto_handler.py index c89ca851..185e8f95 100644 --- a/services/gitauto_handler.py +++ b/services/gitauto_handler.py @@ -50,7 +50,7 @@ async def handle_gitauto( payload: GitHubLabeledPayload, - trigger_type: str, + trigger_type: Literal["label", "comment", "review_comment"], input_from: Literal["github", "jira"], ) -> None: """Core functionality to create comments on issue, create PRs, and update progress.""" diff --git a/services/github/comment_manager.py b/services/github/comment_manager.py index ac3d7d60..e6b25d31 100644 --- a/services/github/comment_manager.py +++ b/services/github/comment_manager.py @@ -1,4 +1,4 @@ -from requests import delete, get +from requests import delete, get, post from config import GITHUB_API_URL, TIMEOUT, GITHUB_APP_USER_NAME from constants.messages import COMPLETED_PR from services.github.create_headers import create_headers @@ -55,3 +55,15 @@ def delete_my_comments(base_args: BaseArgs): # print(f"My comments: {dumps(obj=my_comments, indent=2)}") for comment in my_comments: delete_a_comment(base_args=base_args, comment_id=comment["id"]) + + +def reply_to_comment(base_args: BaseArgs, body: str): + """https://docs.github.com/en/rest/pulls/comments?apiVersion=2022-11-28#create-a-reply-for-a-review-comment""" + owner, repo, token = base_args["owner"], base_args["repo"], base_args["token"] + pull_number = base_args["pull_number"] + comment_id = base_args["review_id"] + url = f"{GITHUB_API_URL}/repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies" + headers: dict[str, str] = create_headers(token=token) + response = post(url=url, headers=headers, json={"body": body}, timeout=TIMEOUT) + response.raise_for_status() + return response.json()["url"] diff --git a/services/github/github_manager.py b/services/github/github_manager.py index 16232bc3..63746013 100644 --- a/services/github/github_manager.py +++ b/services/github/github_manager.py @@ -45,7 +45,7 @@ GitHubLabeledPayload, IssueInfo, ) -from services.github.pulls_manager import add_reviewers +from services.github.reviewers_manager import add_reviewers from services.openai.vision import describe_image from services.supabase import SupabaseManager from utils.detect_new_line import detect_line_break diff --git a/services/github/pulls_manager.py b/services/github/pulls_manager.py index 1c277fe4..b95491d5 100644 --- a/services/github/pulls_manager.py +++ b/services/github/pulls_manager.py @@ -1,43 +1,12 @@ +from json import dumps import requests -from config import GITHUB_API_URL, TIMEOUT, PER_PAGE +from config import TIMEOUT, PER_PAGE from services.github.create_headers import create_headers +from services.github.github_manager import get_remote_file_content from services.github.github_types import BaseArgs -from services.github.user_manager import check_user_is_collaborator from utils.handle_exceptions import handle_exceptions -@handle_exceptions(default_return_value=None, raise_on_error=False) -def add_reviewers(base_args: BaseArgs): - """https://docs.github.com/en/rest/pulls/review-requests?apiVersion=2022-11-28#request-reviewers-for-a-pull-request""" - owner, repo, pr_number, token, reviewers = ( - base_args["owner"], - base_args["repo"], - base_args["pr_number"], - base_args["token"], - base_args["reviewers"], - ) - - # Check if the reviewers are collaborators because reviewers must be collaborators - valid_reviewers: list[str] = [] - for reviewer in reviewers: - is_collaborator = check_user_is_collaborator( - owner=owner, repo=repo, user=reviewer, token=token - ) - if is_collaborator: - valid_reviewers.append(reviewer) - - # If no valid reviewers, return - if not valid_reviewers: - return - - # Add the reviewers to the pull request - url = f"{GITHUB_API_URL}/repos/{owner}/{repo}/pulls/{pr_number}/requested_reviewers" - headers = create_headers(token=token) - json = {"reviewers": valid_reviewers} - response = requests.post(url=url, headers=headers, json=json, timeout=TIMEOUT) - response.raise_for_status() - - @handle_exceptions(default_return_value=("", ""), raise_on_error=False) def get_pull_request(url: str, token: str): """https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#get-a-pull-request""" @@ -51,7 +20,33 @@ def get_pull_request(url: str, token: str): @handle_exceptions(default_return_value=None, raise_on_error=False) -def get_pull_request_files(url: str, token: str): +def get_pull_request_file_contents(url: str, base_args: BaseArgs): + """https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#list-pull-requests-files""" + token = base_args["token"] + headers = create_headers(token=token) + contents: list[str] = [] + page = 1 + while True: + params = {"per_page": PER_PAGE, "page": page} + response = requests.get( + url=url, headers=headers, params=params, timeout=TIMEOUT + ) + response.raise_for_status() + files = response.json() + if not files: + break + for file in files: + file_path = file["filename"] + content = get_remote_file_content(file_path=file_path, base_args=base_args) + contents.append(content) + page += 1 + + print(f"get_pull_request_file_contents: {dumps(obj=contents, indent=2)}") + return contents + + +@handle_exceptions(default_return_value=None, raise_on_error=False) +def get_pull_request_file_changes(url: str, token: str): """https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#list-pull-requests-files""" headers = create_headers(token=token) changes: list[dict[str, str]] = [] diff --git a/services/github/reviewers_manager.py b/services/github/reviewers_manager.py new file mode 100644 index 00000000..18059874 --- /dev/null +++ b/services/github/reviewers_manager.py @@ -0,0 +1,38 @@ +import requests +from config import GITHUB_API_URL, TIMEOUT +from services.github.create_headers import create_headers +from services.github.github_types import BaseArgs +from services.github.user_manager import check_user_is_collaborator +from utils.handle_exceptions import handle_exceptions + + +@handle_exceptions(default_return_value=None, raise_on_error=False) +def add_reviewers(base_args: BaseArgs): + """https://docs.github.com/en/rest/pulls/review-requests?apiVersion=2022-11-28#request-reviewers-for-a-pull-request""" + owner, repo, pr_number, token, reviewers = ( + base_args["owner"], + base_args["repo"], + base_args["pr_number"], + base_args["token"], + base_args["reviewers"], + ) + + # Check if the reviewers are collaborators because reviewers must be collaborators + valid_reviewers: list[str] = [] + for reviewer in reviewers: + is_collaborator = check_user_is_collaborator( + owner=owner, repo=repo, user=reviewer, token=token + ) + if is_collaborator: + valid_reviewers.append(reviewer) + + # If no valid reviewers, return + if not valid_reviewers: + return + + # Add the reviewers to the pull request + url = f"{GITHUB_API_URL}/repos/{owner}/{repo}/pulls/{pr_number}/requested_reviewers" + headers = create_headers(token=token) + json = {"reviewers": valid_reviewers} + response = requests.post(url=url, headers=headers, json=json, timeout=TIMEOUT) + response.raise_for_status() diff --git a/services/openai/instructions/resolve_feedback.py b/services/openai/instructions/resolve_feedback.py new file mode 100644 index 00000000..c0ecd0e1 --- /dev/null +++ b/services/openai/instructions/resolve_feedback.py @@ -0,0 +1,11 @@ +RESOLVE_FEEDBACK = """ +You are an top-class software engineer. +Given information such as a pull request title, body, changes, workflow file content, and check run error log, resolve the feedback and write a plan to fix the error in a language that is used in the input (e.g. the plan should be in English but if the input is mainly in Japanese for example, the plan should be in Japanese). + +Output format would be like this: +## What the feedback is +## Where to change +## How to change + +Each section should be concise and to the point. Should not be long. +""" diff --git a/services/review_run_handler.py b/services/review_run_handler.py new file mode 100644 index 00000000..eba0417f --- /dev/null +++ b/services/review_run_handler.py @@ -0,0 +1,259 @@ +import json +from typing import Any + +# Local imports +from config import ( + GITHUB_APP_USER_NAME, + IS_PRD, + STRIPE_PRODUCT_ID_FREE, + SUPABASE_URL, + SUPABASE_SERVICE_ROLE_KEY, +) +from services.github.comment_manager import reply_to_comment +from services.github.github_manager import ( + get_installation_access_token, + get_remote_file_content, + get_remote_file_tree, + update_comment, +) +from services.github.github_types import Owner, PullRequest, Repository +from services.github.pulls_manager import get_pull_request_file_contents +from services.openai.commit_changes import chat_with_agent +from services.openai.chat import chat_with_ai +from services.openai.instructions.resolve_feedback import RESOLVE_FEEDBACK +from services.stripe.subscriptions import get_stripe_product_id +from services.supabase import SupabaseManager +from services.supabase.owers_manager import get_stripe_customer_id +from utils.colorize_log import colorize +from utils.progress_bar import create_progress_bar + +supabase_manager = SupabaseManager(url=SUPABASE_URL, key=SUPABASE_SERVICE_ROLE_KEY) + + +def handle_review_run(payload: dict[str, Any]) -> None: + # Extract review comment etc + review: dict[str, Any] = payload["comment"] + review_id: str = review["id"] + review_path: str = review["path"] + review_subject_type: str = review["subject_type"] + review_line: int = review["line"] + review_side: str = review["side"] + review_position: int = review["position"] + review_body: str = review["body"] + review_comment = f"## Review Comment\n{review_path} Line: {review_line} Position: {review_position}\n{review_body}" + + # Extract repository related variables + repo: Repository = payload["repository"] + repo_name: str = repo["name"] + is_fork: bool = repo["fork"] + + # Extract owner related variables + owner: Owner = repo["owner"] + owner_type: str = owner["type"] + owner_id: int = owner["id"] + owner_name: str = owner["login"] + + # Extract PR related variables + pull_request: PullRequest = payload["pull_request"] + pull_number: int = pull_request["number"] + pull_title: str = pull_request["title"] + pull_body: str = pull_request["body"] + pull_url: str = pull_request["url"] + pull_file_url: str = f"{pull_url}/files" + head_branch: str = pull_request["head"]["ref"] # gitauto/issue-167-20250101-155924 + pull_user: str = pull_request["user"]["login"] + if pull_user != GITHUB_APP_USER_NAME: + return # Prevent GitAuto from jumping into others' PRs + + # Extract sender related variables and return if sender is GitAuto itself + sender_id: int = payload["sender"]["id"] + sender_name: str = payload["sender"]["login"] + if sender_name == GITHUB_APP_USER_NAME: + return # Prevent infinite loops by self-triggering + + print(f"Payload: {json.dumps(payload, indent=2)}") + + # Extract other information + installation_id: int = payload["installation"]["id"] + token: str = get_installation_access_token(installation_id=installation_id) + base_args: dict[str, str | int | bool] = { + "owner_type": owner_type, + "owner_id": owner_id, + "owner": owner_name, + "repo": repo_name, + "is_fork": is_fork, + "issue_number": pull_number, + "pull_number": pull_number, + "pull_title": pull_title, + "pull_body": pull_body, + "pull_url": pull_url, + "pull_file_url": pull_file_url, + "new_branch": head_branch, + "base_branch": head_branch, # Yes, intentionally set head_branch to base_branch because get_remote_file_tree requires the base branch + "review_id": review_id, + "review_path": review_path, + "review_subject_type": review_subject_type, + "review_line": review_line, + "review_side": review_side, + "review_position": review_position, + "review_body": review_body, + "review_comment": review_comment, + "sender_id": sender_id, + "sender_name": sender_name, + "token": token, + } + + # Return here if stripe_customer_id is not found + stripe_customer_id: str | None = get_stripe_customer_id(owner_id=owner_id) + if stripe_customer_id is None: + return + + # Return here if product_id is not found or is in free tier + product_id: str | None = get_stripe_product_id(customer_id=stripe_customer_id) + if product_id is None or product_id == STRIPE_PRODUCT_ID_FREE and IS_PRD: + msg = f"Skipping because product_id is not found or is in free tier. product_id: '{product_id}'" + print(colorize(text=msg, color="yellow")) + return + + # Get a review commented file + msg = "Thanks for the feedback! Collecting info... 🕵️" + comment_body = create_progress_bar(p=0, msg=msg) + comment_url = reply_to_comment(base_args=base_args, body=comment_body) + base_args["comment_url"] = comment_url + review_file = get_remote_file_content(file_path=review_path, base_args=base_args) + + # Get changed files in the PR + pull_files = get_pull_request_file_contents(url=pull_file_url, base_args=base_args) + + # Get the file tree in the root of the repo + comment_body = "Checking out the file tree in the repo..." + update_comment(body=comment_body, base_args=base_args, p=10) + file_tree: str = get_remote_file_tree(base_args=base_args) + + # Plan how to fix the error + comment_body = "Planning how to achieve your feedback..." + update_comment(body=comment_body, base_args=base_args, p=20) + input_message: dict[str, str] = { + "pull_request_title": pull_title, + "pull_request_body": pull_body, + "review_comment": review_comment, + "review_file": review_file, + "pull_files": pull_files, + "file_tree": file_tree, + } + user_input = json.dumps(obj=input_message) + how_to_fix: str = chat_with_ai(system_input=RESOLVE_FEEDBACK, user_input=user_input) + print(colorize(text=how_to_fix, color="green")) + + # Update the comment if any obstacles are found + comment_body = "Checking if I can solve it or if I should just hit you up..." + update_comment(body=comment_body, base_args=base_args, p=30) + messages = [ + {"role": "system", "content": f"Pull Request Title:\n{pull_title}"}, + {"role": "system", "content": f"Pull Request Body:\n{pull_body}"}, + {"role": "system", "content": f"Pull Request Files:\n{pull_files}"}, + {"role": "system", "content": f"File Tree:\n{file_tree}"}, + {"role": "user", "content": f"Review Comment:\n{review_comment}"}, + {"role": "user", "content": f"Review File:\n{review_file}"}, + {"role": "user", "content": f"How to fix:\n{how_to_fix}"}, + ] + ( + _messages, + _previous_calls, + _tool_name, + _tool_args, + _token_input, + _token_output, + is_commented, + ) = chat_with_agent(messages=messages, base_args=base_args, mode="comment") + if is_commented: + return + + # Loop a process explore repo and commit changes until the ticket is resolved + previous_calls = [] + retry_count = 0 + p = 40 + while True: + # Explore repo + ( + messages, + previous_calls, + tool_name, + tool_args, + _token_input, + _token_output, + is_explored, + ) = chat_with_agent( + messages=messages, + base_args=base_args, + mode="get", # explore can not be used here because "search_remote_file_contents" can search files only in the default branch NOT in the branch that is merged into the default branch + previous_calls=previous_calls, + ) + comment_body = f"Calling `{tool_name}()` with `{tool_args}`..." + update_comment(body=comment_body, base_args=base_args, p=p) + p = min(p + 5, 95) + + # Search Google + ( + messages, + previous_calls, + tool_name, + tool_args, + _token_input, + _token_output, + _is_searched, + ) = chat_with_agent( + messages=messages, + base_args=base_args, + mode="search", + previous_calls=previous_calls, + ) + if tool_name is not None and tool_args is not None: + comment_body = f"Calling `{tool_name}()` with `{tool_args}`..." + update_comment(body=comment_body, base_args=base_args, p=p) + p = min(p + 5, 95) + + # Commit changes based on the exploration information + ( + messages, + previous_calls, + tool_name, + tool_args, + _token_input, + _token_output, + is_committed, + ) = chat_with_agent( + messages=messages, + base_args=base_args, + mode="commit", + previous_calls=previous_calls, + ) + msg = f"Calling `{tool_name}()` with `{tool_args}`..." + update_comment(body=comment_body, base_args=base_args, p=p) + p = min(p + 5, 95) + + # If no new file is found and no changes are made, it means that the agent has completed the ticket or got stuck for some reason + if not is_explored and not is_committed: + break + + # If no files are found but changes are made, it might fall into an infinite loop (e.g., repeatedly making and reverting similar changes with slight variations) + if not is_explored and is_committed: + retry_count += 1 + if retry_count > 3: + break + continue + + # If files are found but no changes are made, it means that the agent found files but didn't think it's necessary to commit changes or fell into an infinite-like loop (e.g. slightly different searches) + if is_explored and not is_committed: + retry_count += 1 + if retry_count > 3: + break + continue + + # Because the agent is committing changes, keep doing the loop + retry_count = 0 + + # Create a pull request to the base branch + msg = "Resolved your feedback! Looks good?" + update_comment(body=msg, base_args=base_args) + return diff --git a/services/webhook_handler.py b/services/webhook_handler.py index d522f362..97c98cec 100644 --- a/services/webhook_handler.py +++ b/services/webhook_handler.py @@ -20,6 +20,7 @@ get_user_public_email, ) from services.github.github_types import GitHubInstallationPayload +from services.review_run_handler import handle_review_run from services.supabase import SupabaseManager from services.gitauto_handler import handle_gitauto from utils.handle_exceptions import handle_exceptions @@ -191,3 +192,9 @@ async def handle_webhook_event(event_name: str, payload: dict[str, Any]) -> None unique_issue_id = f"{owner_type}/{payload['repository']['owner']['login']}/{payload['repository']['name']}#{issue_number}" supabase_manager.set_issue_to_merged(unique_issue_id=unique_issue_id) return + + # https://docs.github.com/en/webhooks/webhook-events-and-payloads#pull_request_review_comment + # Do nothing when action is "deleted" + if event_name == "pull_request_review_comment" and action in ("created", "edited"): + handle_review_run(payload=payload) + return