{"action":"created","comment":{"url":"https://api.github.com/repos/mitodl/release-script/pulls/comments/202060777","pull_request_review_id":136682979,"id":202060777,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMjA2MDc3Nw==","diff_hunk":"@@ -40,6 +44,39 @@ def tag_release(version):\n     check_call(['git', 'push', '--follow-tags'])\n \n \n+def set_release_date(version):\n+    \"\"\"Sets the release date(s) in RELEASE.rst for any versions missing it\"\"\"\n+    print(\"Setting release date...\")\n+    release_filename = \"RELEASE.rst\"\n+    if not os.path.isfile(release_filename):\n+        return\n+    date_format = \"%Y-%m-%d\"\n+    check_call([\"git\", \"fetch\", \"--tags\"])\n+\n+    with open(release_filename) as f:\n+        existing_note_lines = [line for line in f.readlines()]\n+\n+    try:\n+        with open(release_filename, \"w\") as f:\n+            for line in existing_note_lines:\n+                if line.startswith(\"Version \") and \"Released\" not in line:\n+                    version_match = re.search(r\"[0-9\\.]+\", line)\n+                    if version_match:\n+                        version_line = version_match.group(0)\n+                        version_date = check_output(\n+                            [\"git\", \"log\", \"-1\", \"--format=%ai\", \"v{}\".format(version_line)]\n+                        ).rstrip()\n+                        localtime = datetime.strptime(version_date.decode(\"utf-8\"), \"%Y-%m-%d %H:%M:%S %z\").\\\n+                            astimezone(pytz.timezone(\"America/New_York\")).strftime(date_format)","path":"finish_release.py","position":43,"original_position":43,"commit_id":"3d39cacc97e3beba2ab5e2c5f310f55ad4abc425","original_commit_id":"3d39cacc97e3beba2ab5e2c5f310f55ad4abc425","user":{"login":"noisecapella","id":863262,"node_id":"MDQ6VXNlcjg2MzI2Mg==","avatar_url":"https://avatars2.githubusercontent.com/u/863262?v=4","gravatar_id":"","url":"https://api.github.com/users/noisecapella","html_url":"https://github.com/noisecapella","followers_url":"https://api.github.com/users/noisecapella/followers","following_url":"https://api.github.com/users/noisecapella/following{/other_user}","gists_url":"https://api.github.com/users/noisecapella/gists{/gist_id}","starred_url":"https://api.github.com/users/noisecapella/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noisecapella/subscriptions","organizations_url":"https://api.github.com/users/noisecapella/orgs","repos_url":"https://api.github.com/users/noisecapella/repos","events_url":"https://api.github.com/users/noisecapella/events{/privacy}","received_events_url":"https://api.github.com/users/noisecapella/received_events","type":"User","site_admin":false},"body":"It's pedantic but can we use `pytz.timezone(envs['TIMEZONE'])` instead?","created_at":"2018-07-12T14:42:12Z","updated_at":"2018-07-12T14:49:39Z","html_url":"https://github.com/mitodl/release-script/pull/159#discussion_r202060777","pull_request_url":"https://api.github.com/repos/mitodl/release-script/pulls/159","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/mitodl/release-script/pulls/comments/202060777"},"html":{"href":"https://github.com/mitodl/release-script/pull/159#discussion_r202060777"},"pull_request":{"href":"https://api.github.com/repos/mitodl/release-script/pulls/159"}}},"pull_request":{"url":"https://api.github.com/repos/mitodl/release-script/pulls/159","id":200828128,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAwODI4MTI4","html_url":"https://github.com/mitodl/release-script/pull/159","diff_url":"https://github.com/mitodl/release-script/pull/159.diff","patch_url":"https://github.com/mitodl/release-script/pull/159.patch","issue_url":"https://api.github.com/repos/mitodl/release-script/issues/159","number":159,"state":"open","locked":false,"title":"Insert release dates into RELEASE.rst","user":{"login":"mbertrand","id":187676,"node_id":"MDQ6VXNlcjE4NzY3Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/187676?v=4","gravatar_id":"","url":"https://api.github.com/users/mbertrand","html_url":"https://github.com/mbertrand","followers_url":"https://api.github.com/users/mbertrand/followers","following_url":"https://api.github.com/users/mbertrand/following{/other_user}","gists_url":"https://api.github.com/users/mbertrand/gists{/gist_id}","starred_url":"https://api.github.com/users/mbertrand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbertrand/subscriptions","organizations_url":"https://api.github.com/users/mbertrand/orgs","repos_url":"https://api.github.com/users/mbertrand/repos","events_url":"https://api.github.com/users/mbertrand/events{/privacy}","received_events_url":"https://api.github.com/users/mbertrand/received_events","type":"User","site_admin":false},"body":"#### What are the relevant tickets?\r\n- Closes #158\r\n\r\n#### What's this PR do?\r\nGoes through RELEASE.rst line by line and appends a release date (based on date of version tag) to each line that is equal to \"Version &lt;number&gt;\", then commits and pushes the change.\r\n\r\n#### How should this be manually tested?\r\n- Partial test: In a python shell opened in a repo directory, copy over the `set_release_date` function and run it.\r\n- Run a release\r\n\r\n","created_at":"2018-07-11T21:17:12Z","updated_at":"2018-07-12T14:49:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4f6d90370596c89eaf5913224b0b930ae21aabcf","assignee":{"login":"noisecapella","id":863262,"node_id":"MDQ6VXNlcjg2MzI2Mg==","avatar_url":"https://avatars2.githubusercontent.com/u/863262?v=4","gravatar_id":"","url":"https://api.github.com/users/noisecapella","html_url":"https://github.com/noisecapella","followers_url":"https://api.github.com/users/noisecapella/followers","following_url":"https://api.github.com/users/noisecapella/following{/other_user}","gists_url":"https://api.github.com/users/noisecapella/gists{/gist_id}","starred_url":"https://api.github.com/users/noisecapella/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noisecapella/subscriptions","organizations_url":"https://api.github.com/users/noisecapella/orgs","repos_url":"https://api.github.com/users/noisecapella/repos","events_url":"https://api.github.com/users/noisecapella/events{/privacy}","received_events_url":"https://api.github.com/users/noisecapella/received_events","type":"User","site_admin":false},"assignees":[{"login":"noisecapella","id":863262,"node_id":"MDQ6VXNlcjg2MzI2Mg==","avatar_url":"https://avatars2.githubusercontent.com/u/863262?v=4","gravatar_id":"","url":"https://api.github.com/users/noisecapella","html_url":"https://github.com/noisecapella","followers_url":"https://api.github.com/users/noisecapella/followers","following_url":"https://api.github.com/users/noisecapella/following{/other_user}","gists_url":"https://api.github.com/users/noisecapella/gists{/gist_id}","starred_url":"https://api.github.com/users/noisecapella/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noisecapella/subscriptions","organizations_url":"https://api.github.com/users/noisecapella/orgs","repos_url":"https://api.github.com/users/noisecapella/repos","events_url":"https://api.github.com/users/noisecapella/events{/privacy}","received_events_url":"https://api.github.com/users/noisecapella/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":324682350,"node_id":"MDU6TGFiZWwzMjQ2ODIzNTA=","url":"https://api.github.com/repos/mitodl/release-script/labels/Needs%20review","name":"Needs review","color":"fef2c0","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/mitodl/release-script/pulls/159/commits","review_comments_url":"https://api.github.com/repos/mitodl/release-script/pulls/159/comments","review_comment_url":"https://api.github.com/repos/mitodl/release-script/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mitodl/release-script/issues/159/comments","statuses_url":"https://api.github.com/repos/mitodl/release-script/statuses/3d39cacc97e3beba2ab5e2c5f310f55ad4abc425","head":{"label":"mitodl:mb/release_dates","ref":"mb/release_dates","sha":"3d39cacc97e3beba2ab5e2c5f310f55ad4abc425","user":{"login":"mitodl","id":7918516,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc5MTg1MTY=","avatar_url":"https://avatars2.githubusercontent.com/u/7918516?v=4","gravatar_id":"","url":"https://api.github.com/users/mitodl","html_url":"https://github.com/mitodl","followers_url":"https://api.github.com/users/mitodl/followers","following_url":"https://api.github.com/users/mitodl/following{/other_user}","gists_url":"https://api.github.com/users/mitodl/gists{/gist_id}","starred_url":"https://api.github.com/users/mitodl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitodl/subscriptions","organizations_url":"https://api.github.com/users/mitodl/orgs","repos_url":"https://api.github.com/users/mitodl/repos","events_url":"https://api.github.com/users/mitodl/events{/privacy}","received_events_url":"https://api.github.com/users/mitodl/received_events","type":"Organization","site_admin":false},"repo":{"id":51475352,"node_id":"MDEwOlJlcG9zaXRvcnk1MTQ3NTM1Mg==","name":"release-script","full_name":"mitodl/release-script","owner":{"login":"mitodl","id":7918516,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc5MTg1MTY=","avatar_url":"https://avatars2.githubusercontent.com/u/7918516?v=4","gravatar_id":"","url":"https://api.github.com/users/mitodl","html_url":"https://github.com/mitodl","followers_url":"https://api.github.com/users/mitodl/followers","following_url":"https://api.github.com/users/mitodl/following{/other_user}","gists_url":"https://api.github.com/users/mitodl/gists{/gist_id}","starred_url":"https://api.github.com/users/mitodl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitodl/subscriptions","organizations_url":"https://api.github.com/users/mitodl/orgs","repos_url":"https://api.github.com/users/mitodl/repos","events_url":"https://api.github.com/users/mitodl/events{/privacy}","received_events_url":"https://api.github.com/users/mitodl/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mitodl/release-script","description":"Scripts to automate the release process.","fork":false,"url":"https://api.github.com/repos/mitodl/release-script","forks_url":"https://api.github.com/repos/mitodl/release-script/forks","keys_url":"https://api.github.com/repos/mitodl/release-script/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mitodl/release-script/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mitodl/release-script/teams","hooks_url":"https://api.github.com/repos/mitodl/release-script/hooks","issue_events_url":"https://api.github.com/repos/mitodl/release-script/issues/events{/number}","events_url":"https://api.github.com/repos/mitodl/release-script/events","assignees_url":"https://api.github.com/repos/mitodl/release-script/assignees{/user}","branches_url":"https://api.github.com/repos/mitodl/release-script/branches{/branch}","tags_url":"https://api.github.com/repos/mitodl/release-script/tags","blobs_url":"https://api.github.com/repos/mitodl/release-script/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mitodl/release-script/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mitodl/release-script/git/refs{/sha}","trees_url":"https://api.github.com/repos/mitodl/release-script/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mitodl/release-script/statuses/{sha}","languages_url":"https://api.github.com/repos/mitodl/release-script/languages","stargazers_url":"https://api.github.com/repos/mitodl/release-script/stargazers","contributors_url":"https://api.github.com/repos/mitodl/release-script/contributors","subscribers_url":"https://api.github.com/repos/mitodl/release-script/subscribers","subscription_url":"https://api.github.com/repos/mitodl/release-script/subscription","commits_url":"https://api.github.com/repos/mitodl/release-script/commits{/sha}","git_commits_url":"https://api.github.com/repos/mitodl/release-script/git/commits{/sha}","comments_url":"https://api.github.com/repos/mitodl/release-script/comments{/number}","issue_comment_url":"https://api.github.com/repos/mitodl/release-script/issues/comments{/number}","contents_url":"https://api.github.com/repos/mitodl/release-script/contents/{+path}","compare_url":"https://api.github.com/repos/mitodl/release-script/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mitodl/release-script/merges","archive_url":"https://api.github.com/repos/mitodl/release-script/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mitodl/release-script/downloads","issues_url":"https://api.github.com/repos/mitodl/release-script/issues{/number}","pulls_url":"https://api.github.com/repos/mitodl/release-script/pulls{/number}","milestones_url":"https://api.github.com/repos/mitodl/release-script/milestones{/number}","notifications_url":"https://api.github.com/repos/mitodl/release-script/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mitodl/release-script/labels{/name}","releases_url":"https://api.github.com/repos/mitodl/release-script/releases{/id}","deployments_url":"https://api.github.com/repos/mitodl/release-script/deployments","created_at":"2016-02-10T21:55:18Z","updated_at":"2018-05-25T08:23:51Z","pushed_at":"2018-07-12T13:30:58Z","git_url":"git://github.com/mitodl/release-script.git","ssh_url":"git@github.com:mitodl/release-script.git","clone_url":"https://github.com/mitodl/release-script.git","svn_url":"https://github.com/mitodl/release-script","homepage":null,"size":1280,"stargazers_count":9,"watchers_count":9,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":24,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":5,"open_issues":24,"watchers":9,"default_branch":"master"}},"base":{"label":"mitodl:master","ref":"master","sha":"992480167c81a461c4dea86590d4b7530a7858be","user":{"login":"mitodl","id":7918516,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc5MTg1MTY=","avatar_url":"https://avatars2.githubusercontent.com/u/7918516?v=4","gravatar_id":"","url":"https://api.github.com/users/mitodl","html_url":"https://github.com/mitodl","followers_url":"https://api.github.com/users/mitodl/followers","following_url":"https://api.github.com/users/mitodl/following{/other_user}","gists_url":"https://api.github.com/users/mitodl/gists{/gist_id}","starred_url":"https://api.github.com/users/mitodl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitodl/subscriptions","organizations_url":"https://api.github.com/users/mitodl/orgs","repos_url":"https://api.github.com/users/mitodl/repos","events_url":"https://api.github.com/users/mitodl/events{/privacy}","received_events_url":"https://api.github.com/users/mitodl/received_events","type":"Organization","site_admin":false},"repo":{"id":51475352,"node_id":"MDEwOlJlcG9zaXRvcnk1MTQ3NTM1Mg==","name":"release-script","full_name":"mitodl/release-script","owner":{"login":"mitodl","id":7918516,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc5MTg1MTY=","avatar_url":"https://avatars2.githubusercontent.com/u/7918516?v=4","gravatar_id":"","url":"https://api.github.com/users/mitodl","html_url":"https://github.com/mitodl","followers_url":"https://api.github.com/users/mitodl/followers","following_url":"https://api.github.com/users/mitodl/following{/other_user}","gists_url":"https://api.github.com/users/mitodl/gists{/gist_id}","starred_url":"https://api.github.com/users/mitodl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitodl/subscriptions","organizations_url":"https://api.github.com/users/mitodl/orgs","repos_url":"https://api.github.com/users/mitodl/repos","events_url":"https://api.github.com/users/mitodl/events{/privacy}","received_events_url":"https://api.github.com/users/mitodl/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mitodl/release-script","description":"Scripts to automate the release process.","fork":false,"url":"https://api.github.com/repos/mitodl/release-script","forks_url":"https://api.github.com/repos/mitodl/release-script/forks","keys_url":"https://api.github.com/repos/mitodl/release-script/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mitodl/release-script/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mitodl/release-script/teams","hooks_url":"https://api.github.com/repos/mitodl/release-script/hooks","issue_events_url":"https://api.github.com/repos/mitodl/release-script/issues/events{/number}","events_url":"https://api.github.com/repos/mitodl/release-script/events","assignees_url":"https://api.github.com/repos/mitodl/release-script/assignees{/user}","branches_url":"https://api.github.com/repos/mitodl/release-script/branches{/branch}","tags_url":"https://api.github.com/repos/mitodl/release-script/tags","blobs_url":"https://api.github.com/repos/mitodl/release-script/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mitodl/release-script/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mitodl/release-script/git/refs{/sha}","trees_url":"https://api.github.com/repos/mitodl/release-script/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mitodl/release-script/statuses/{sha}","languages_url":"https://api.github.com/repos/mitodl/release-script/languages","stargazers_url":"https://api.github.com/repos/mitodl/release-script/stargazers","contributors_url":"https://api.github.com/repos/mitodl/release-script/contributors","subscribers_url":"https://api.github.com/repos/mitodl/release-script/subscribers","subscription_url":"https://api.github.com/repos/mitodl/release-script/subscription","commits_url":"https://api.github.com/repos/mitodl/release-script/commits{/sha}","git_commits_url":"https://api.github.com/repos/mitodl/release-script/git/commits{/sha}","comments_url":"https://api.github.com/repos/mitodl/release-script/comments{/number}","issue_comment_url":"https://api.github.com/repos/mitodl/release-script/issues/comments{/number}","contents_url":"https://api.github.com/repos/mitodl/release-script/contents/{+path}","compare_url":"https://api.github.com/repos/mitodl/release-script/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mitodl/release-script/merges","archive_url":"https://api.github.com/repos/mitodl/release-script/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mitodl/release-script/downloads","issues_url":"https://api.github.com/repos/mitodl/release-script/issues{/number}","pulls_url":"https://api.github.com/repos/mitodl/release-script/pulls{/number}","milestones_url":"https://api.github.com/repos/mitodl/release-script/milestones{/number}","notifications_url":"https://api.github.com/repos/mitodl/release-script/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mitodl/release-script/labels{/name}","releases_url":"https://api.github.com/repos/mitodl/release-script/releases{/id}","deployments_url":"https://api.github.com/repos/mitodl/release-script/deployments","created_at":"2016-02-10T21:55:18Z","updated_at":"2018-05-25T08:23:51Z","pushed_at":"2018-07-12T13:30:58Z","git_url":"git://github.com/mitodl/release-script.git","ssh_url":"git@github.com:mitodl/release-script.git","clone_url":"https://github.com/mitodl/release-script.git","svn_url":"https://github.com/mitodl/release-script","homepage":null,"size":1280,"stargazers_count":9,"watchers_count":9,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":24,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":5,"open_issues":24,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mitodl/release-script/pulls/159"},"html":{"href":"https://github.com/mitodl/release-script/pull/159"},"issue":{"href":"https://api.github.com/repos/mitodl/release-script/issues/159"},"comments":{"href":"https://api.github.com/repos/mitodl/release-script/issues/159/comments"},"review_comments":{"href":"https://api.github.com/repos/mitodl/release-script/pulls/159/comments"},"review_comment":{"href":"https://api.github.com/repos/mitodl/release-script/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mitodl/release-script/pulls/159/commits"},"statuses":{"href":"https://api.github.com/repos/mitodl/release-script/statuses/3d39cacc97e3beba2ab5e2c5f310f55ad4abc425"}},"author_association":"NONE"}}
{"actor":{"display_login":"noisecapella"}}