{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/pulls/comments/265228315","pull_request_review_id":214080400,"id":265228315,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI2NTIyODMxNQ==","diff_hunk":"@@ -518,61 +518,64 @@ def compare_versions(version_path, scriptworker_repo, latest_releases):\n         return True\n \n \n-def extract_json_from_git(json_files, path_to_files, days_to_generate):\n+def extract_json_from_git(repository, days_to_generate):\n     \"\"\"\n     Extracts the json data from json files and writes the data to the main\n     markdown table file.\n     The function looks into json files after the last commit, extracts it and\n     calls the write_main_md_table function.\n     :param days_to_generate:\n-    :param json_files: List of files to extract commits from.\n-    :param path_to_files: Folder to json files\n+    :param repository:\n     :return: none\n     \"\"\"\n+    from fic_modules.markdown_modules import generate_markdown_header, \\\n+        write_main_md_table\n+    from fic_modules.helper_functions import generate_repository_url\n+\n+    nr_days_ago = datetime.utcnow() - timedelta(days=days_to_generate)\n+\n+    count_pushes = 0\n+    with open(\"./changelog.json\") as json_file:\n+        data = json.load(json_file)\n+\n+        for repo in repository:\n+            repository_url = generate_repository_url(\"git_files\", repo, \"json\")\n+            repository_json = generate_repository_url(\"git_files\", repo, \"md\")\n \n-    time_24h_ago = datetime.utcnow() - timedelta(days=days_to_generate)\n-    test = datetime.strftime(time_24h_ago, \"%Y-%m-%d %H:%M:%S\")\n-    time_24h_ago = datetime.strptime(test, \"%Y-%m-%d %H:%M:%S\")\n-\n-    for file in json_files:\n-        file_path = \"{}/\".format(path_to_files) + file\n-        count_pushes = 0\n-        with open(file_path) as json_file:\n-            data = json.load(json_file)\n-            base_link = \"https://github.com/mozilla-releng/firefox-infra-\" \\\n-                        \"changelog/blob/master/{}/\" \\\n-                        .format(path_to_files)\n-            repository_url = base_link + file \\\n-                .rstrip() \\\n-                .replace(\" \", \"%20\") \\\n-                .rstrip() \\\n-                .replace(\".json\", \".md\")\n-            repository_json = base_link + file \\\n-                .rstrip() \\\n-                .replace(\" \", \"%20\")\n-            repository_title = file.replace(\".json\", \"\")\n             try:\n                 generate_markdown_header(\"changelog.md\",\n-                                         repository_title,\n+                                         repo,\n                                          repository_url,\n                                          repository_json)\n                 if \"0\" in data:\n                     del data[\"0\"]\n-                for commit_iterator in data:\n+\n+                for commit_iterator in data.get(\"Github\").get(repo):\n                     commit_number = str(commit_iterator)\n-                    commit_date = data.get(commit_number).get(\"commit_date\")\n-                    is_it_under_24 = datetime.strptime(commit_date,\n-                                                       \"%Y-%m-%d %H:%M:%S\")\n-                    if is_it_under_24 > time_24h_ago:\n+\n+                    commit_date = data.get(\"Github\")\\\n+                        .get(repo)\\\n+                        .get(commit_number)\\\n+                        .get(\"commit_date\")\n+                    commit_date = datetime.strptime(commit_date, \"%Y-%m-%d %H:%M:%S\")\n+\n+                    if commit_date > nr_days_ago:\n                         count_pushes = count_pushes + 1\n-                        commit_description = data \\\n+                        commit_description = data.get(\"Github\").get(repo) \\","path":"fic_modules/git.py","position":135,"original_position":135,"commit_id":"1b0295fca72209071bd58b5a5f55309e62b71dc8","original_commit_id":"1b0295fca72209071bd58b5a5f55309e62b71dc8","user":{"login":"Akhliskun","id":25681178,"node_id":"MDQ6VXNlcjI1NjgxMTc4","avatar_url":"https://avatars1.githubusercontent.com/u/25681178?v=4","gravatar_id":"","url":"https://api.github.com/users/Akhliskun","html_url":"https://github.com/Akhliskun","followers_url":"https://api.github.com/users/Akhliskun/followers","following_url":"https://api.github.com/users/Akhliskun/following{/other_user}","gists_url":"https://api.github.com/users/Akhliskun/gists{/gist_id}","starred_url":"https://api.github.com/users/Akhliskun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Akhliskun/subscriptions","organizations_url":"https://api.github.com/users/Akhliskun/orgs","repos_url":"https://api.github.com/users/Akhliskun/repos","events_url":"https://api.github.com/users/Akhliskun/events{/privacy}","received_events_url":"https://api.github.com/users/Akhliskun/received_events","type":"User","site_admin":false},"body":"Weird .get() styles here.\r\n2 .get() on 1 line and 1 .get() on 2 lines.","created_at":"2019-03-13T16:50:22Z","updated_at":"2019-03-13T16:56:18Z","html_url":"https://github.com/mozilla-releng/firefox-infra-changelog/pull/322#discussion_r265228315","pull_request_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/pulls/322","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/pulls/comments/265228315"},"html":{"href":"https://github.com/mozilla-releng/firefox-infra-changelog/pull/322#discussion_r265228315"},"pull_request":{"href":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/pulls/322"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/pulls/322","id":260846520,"node_id":"MDExOlB1bGxSZXF1ZXN0MjYwODQ2NTIw","html_url":"https://github.com/mozilla-releng/firefox-infra-changelog/pull/322","diff_url":"https://github.com/mozilla-releng/firefox-infra-changelog/pull/322.diff","patch_url":"https://github.com/mozilla-releng/firefox-infra-changelog/pull/322.patch","issue_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/issues/322","number":322,"state":"open","locked":false,"title":"Issue 302","user":{"login":"bccrisan","id":19187500,"node_id":"MDQ6VXNlcjE5MTg3NTAw","avatar_url":"https://avatars2.githubusercontent.com/u/19187500?v=4","gravatar_id":"","url":"https://api.github.com/users/bccrisan","html_url":"https://github.com/bccrisan","followers_url":"https://api.github.com/users/bccrisan/followers","following_url":"https://api.github.com/users/bccrisan/following{/other_user}","gists_url":"https://api.github.com/users/bccrisan/gists{/gist_id}","starred_url":"https://api.github.com/users/bccrisan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bccrisan/subscriptions","organizations_url":"https://api.github.com/users/bccrisan/orgs","repos_url":"https://api.github.com/users/bccrisan/repos","events_url":"https://api.github.com/users/bccrisan/events{/privacy}","received_events_url":"https://api.github.com/users/bccrisan/received_events","type":"User","site_admin":false},"body":"Fix for issue #302:\r\n- Added new function to generate the url generation (for both MD and JSON Links).\r\n- Adapted dict getters to correctly pull the data from `data` (in both git.py and hg.py).\r\n- Added KeyError handler to try-except in git.py.\r\n- Modified generate_main_md_table() to accept the new parameter and updated calls.","created_at":"2019-03-13T16:37:10Z","updated_at":"2019-03-13T16:56:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c3ece23613c8b1075a277674441c1c4cee78c5fe","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/pulls/322/commits","review_comments_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/pulls/322/comments","review_comment_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/issues/322/comments","statuses_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/statuses/1b0295fca72209071bd58b5a5f55309e62b71dc8","head":{"label":"mozilla-releng:issue-302","ref":"issue-302","sha":"1b0295fca72209071bd58b5a5f55309e62b71dc8","user":{"login":"mozilla-releng","id":19614164,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5NjE0MTY0","avatar_url":"https://avatars1.githubusercontent.com/u/19614164?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla-releng","html_url":"https://github.com/mozilla-releng","followers_url":"https://api.github.com/users/mozilla-releng/followers","following_url":"https://api.github.com/users/mozilla-releng/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-releng/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-releng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-releng/subscriptions","organizations_url":"https://api.github.com/users/mozilla-releng/orgs","repos_url":"https://api.github.com/users/mozilla-releng/repos","events_url":"https://api.github.com/users/mozilla-releng/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-releng/received_events","type":"Organization","site_admin":false},"repo":{"id":140776615,"node_id":"MDEwOlJlcG9zaXRvcnkxNDA3NzY2MTU=","name":"firefox-infra-changelog","full_name":"mozilla-releng/firefox-infra-changelog","private":false,"owner":{"login":"mozilla-releng","id":19614164,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5NjE0MTY0","avatar_url":"https://avatars1.githubusercontent.com/u/19614164?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla-releng","html_url":"https://github.com/mozilla-releng","followers_url":"https://api.github.com/users/mozilla-releng/followers","following_url":"https://api.github.com/users/mozilla-releng/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-releng/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-releng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-releng/subscriptions","organizations_url":"https://api.github.com/users/mozilla-releng/orgs","repos_url":"https://api.github.com/users/mozilla-releng/repos","events_url":"https://api.github.com/users/mozilla-releng/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-releng/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/mozilla-releng/firefox-infra-changelog","description":"Automated tool which builds a changelog of commits happening on git and hg that could affect Firefox CI Infra.","fork":false,"url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog","forks_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/forks","keys_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/teams","hooks_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/hooks","issue_events_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/events","assignees_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/tags","blobs_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/languages","stargazers_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/stargazers","contributors_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/contributors","subscribers_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/subscribers","subscription_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/subscription","commits_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/merges","archive_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/downloads","issues_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/deployments","created_at":"2018-07-13T00:15:13Z","updated_at":"2019-03-13T14:51:42Z","pushed_at":"2019-03-13T16:37:10Z","git_url":"git://github.com/mozilla-releng/firefox-infra-changelog.git","ssh_url":"git@github.com:mozilla-releng/firefox-infra-changelog.git","clone_url":"https://github.com/mozilla-releng/firefox-infra-changelog.git","svn_url":"https://github.com/mozilla-releng/firefox-infra-changelog","homepage":null,"size":26532,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":6,"open_issues":5,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla-releng:master","ref":"master","sha":"238b4afc24348d27c40d107569cdeac5de3d541c","user":{"login":"mozilla-releng","id":19614164,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5NjE0MTY0","avatar_url":"https://avatars1.githubusercontent.com/u/19614164?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla-releng","html_url":"https://github.com/mozilla-releng","followers_url":"https://api.github.com/users/mozilla-releng/followers","following_url":"https://api.github.com/users/mozilla-releng/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-releng/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-releng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-releng/subscriptions","organizations_url":"https://api.github.com/users/mozilla-releng/orgs","repos_url":"https://api.github.com/users/mozilla-releng/repos","events_url":"https://api.github.com/users/mozilla-releng/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-releng/received_events","type":"Organization","site_admin":false},"repo":{"id":140776615,"node_id":"MDEwOlJlcG9zaXRvcnkxNDA3NzY2MTU=","name":"firefox-infra-changelog","full_name":"mozilla-releng/firefox-infra-changelog","private":false,"owner":{"login":"mozilla-releng","id":19614164,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5NjE0MTY0","avatar_url":"https://avatars1.githubusercontent.com/u/19614164?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla-releng","html_url":"https://github.com/mozilla-releng","followers_url":"https://api.github.com/users/mozilla-releng/followers","following_url":"https://api.github.com/users/mozilla-releng/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-releng/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-releng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-releng/subscriptions","organizations_url":"https://api.github.com/users/mozilla-releng/orgs","repos_url":"https://api.github.com/users/mozilla-releng/repos","events_url":"https://api.github.com/users/mozilla-releng/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-releng/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/mozilla-releng/firefox-infra-changelog","description":"Automated tool which builds a changelog of commits happening on git and hg that could affect Firefox CI Infra.","fork":false,"url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog","forks_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/forks","keys_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/teams","hooks_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/hooks","issue_events_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/events","assignees_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/tags","blobs_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/languages","stargazers_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/stargazers","contributors_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/contributors","subscribers_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/subscribers","subscription_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/subscription","commits_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/merges","archive_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/downloads","issues_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/deployments","created_at":"2018-07-13T00:15:13Z","updated_at":"2019-03-13T14:51:42Z","pushed_at":"2019-03-13T16:37:10Z","git_url":"git://github.com/mozilla-releng/firefox-infra-changelog.git","ssh_url":"git@github.com:mozilla-releng/firefox-infra-changelog.git","clone_url":"https://github.com/mozilla-releng/firefox-infra-changelog.git","svn_url":"https://github.com/mozilla-releng/firefox-infra-changelog","homepage":null,"size":26532,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":6,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/pulls/322"},"html":{"href":"https://github.com/mozilla-releng/firefox-infra-changelog/pull/322"},"issue":{"href":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/issues/322"},"comments":{"href":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/issues/322/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/pulls/322/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/pulls/322/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla-releng/firefox-infra-changelog/statuses/1b0295fca72209071bd58b5a5f55309e62b71dc8"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"Akhliskun"}}