{"action":"created","comment":{"url":"https://api.github.com/repos/fastlane/fastlane/pulls/comments/53833685","id":53833685,"diff_hunk":"@@ -0,0 +1,82 @@\n+module Fastlane\n+  module Actions\n+    module SharedValues\n+      UPDATE_ICLOUD_CONTAINER_IDENTIFIERS = :UPDATE_ICLOUD_CONTAINER_IDENTIFIERS\n+    end\n+\n+    class UpdateIcloudContainerIdentifiersAction < Action\n+      require 'plist'\n+\n+      def self.run(params)\n+        UI.message \"Entitlements File: #{params[:entitlements_file]}\"\n+\n+        entitlements_file = params[:entitlements_file]\n+        raise \"Could not find entitlements file at path '#{entitlements_file}'\".red unless File.exist?(entitlements_file)\n+\n+        # parse entitlements\n+        result = Plist.parse_xml(entitlements_file)\n+        raise \"Entitlements file at '#{entitlements_file}' cannot be parsed.\".red unless result\n+\n+        # get iCloud container field\n+        icloud_container_key = 'com.apple.developer.icloud-container-identifiers'\n+        icloud_container_value = result[icloud_container_key]\n+        raise 'No existing iCloud container field specified. Please specify an iCloud container in the entitlements file.'.red unless icloud_container_value\n+\n+        # get uniquity container field\n+        ubiquity_container_key = 'com.apple.developer.ubiquity-container-identifiers'\n+        ubiquity_container_value = result[ubiquity_container_key]\n+        raise 'No existing ubiquity container field specified. Please specify an ubiquity container in the entitlements file.'.red unless ubiquity_container_value\n+\n+        # set iCloud container identifiers\n+        result[icloud_container_key] = params[:icloud_container_identifiers]\n+        result[ubiquity_container_key] = params[:icloud_container_identifiers]\n+\n+        # save entitlements file\n+        result.save_plist(entitlements_file)\n+\n+        UI.message \"Old iCloud Container Identifiers: #{icloud_container_value}\"\n+        UI.message \"Old Ubiquity Container Identifiers: #{ubiquity_container_value}\"\n+\n+        UI.success \"New iCloud Container Identifiers set: #{result[icloud_container_key]}\"\n+        UI.success \"New Ubiquity Container Identifiers set: #{result[ubiquity_container_key]}\"\n+\n+        Actions.lane_context[SharedValues::UPDATE_ICLOUD_CONTAINER_IDENTIFIERS] = result[icloud_container_key]\n+      end\n+\n+      def self.description\n+        \"This action changes the iCloud container identifiers in the entitlements file\"\n+      end\n+\n+      def self.available_options\n+        [\n+          FastlaneCore::ConfigItem.new(key: :entitlements_file,\n+                                       env_name: \"FL_UPDATE_ICLOUD_CONTAINER_IDENTIFIERS_ENTITLEMENTS_FILE_PATH\",\n+                                       description: \"The path to the entitlement file which contains the iCloud container identifiers\",\n+                                       verify_block: proc do |value|\n+                                         raise \"Please pass a path to an entitlements file. \".red unless value.include? \".entitlements\"\n+                                         raise \"Could not find entitlements file\".red if !File.exist?(value) and !Helper.is_test?\n+                                       end),\n+          FastlaneCore::ConfigItem.new(key: :icloud_container_identifiers,\n+                                       env_name: \"FL_UPDATE_ICLOUD_CONTAINER_IDENTIFIERS_IDENTIFIERS\",\n+                                       description: \"An Array of unique identifiers for the iCloud containers. Eg. ['iCloud.com.test.testapp']\",\n+                                       is_string: false,\n+                                       verify_block: proc do |value|\n+                                         raise \"The parameter icloud_container_identifiers need to be an Array.\".red unless value.kind_of? Array","path":"lib/fastlane/actions/update_icloud_container_identifiers.rb","position":64,"original_position":64,"commit_id":"855b561ac1ea5e56545d63efd5d92180d148365b","original_commit_id":"855b561ac1ea5e56545d63efd5d92180d148365b","user":{"login":"asfalcone","id":1848683,"avatar_url":"https://avatars.githubusercontent.com/u/1848683?v=3","gravatar_id":"","url":"https://api.github.com/users/asfalcone","html_url":"https://github.com/asfalcone","followers_url":"https://api.github.com/users/asfalcone/followers","following_url":"https://api.github.com/users/asfalcone/following{/other_user}","gists_url":"https://api.github.com/users/asfalcone/gists{/gist_id}","starred_url":"https://api.github.com/users/asfalcone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asfalcone/subscriptions","organizations_url":"https://api.github.com/users/asfalcone/orgs","repos_url":"https://api.github.com/users/asfalcone/repos","events_url":"https://api.github.com/users/asfalcone/events{/privacy}","received_events_url":"https://api.github.com/users/asfalcone/received_events","type":"User","site_admin":false},"body":"use `UI.user_error` instead of raise","created_at":"2016-02-23T19:19:30Z","updated_at":"2016-02-23T19:19:30Z","html_url":"https://github.com/fastlane/fastlane/pull/1299#discussion_r53833685","pull_request_url":"https://api.github.com/repos/fastlane/fastlane/pulls/1299","_links":{"self":{"href":"https://api.github.com/repos/fastlane/fastlane/pulls/comments/53833685"},"html":{"href":"https://github.com/fastlane/fastlane/pull/1299#discussion_r53833685"},"pull_request":{"href":"https://api.github.com/repos/fastlane/fastlane/pulls/1299"}}},"pull_request":{"url":"https://api.github.com/repos/fastlane/fastlane/pulls/1299","id":59045019,"html_url":"https://github.com/fastlane/fastlane/pull/1299","diff_url":"https://github.com/fastlane/fastlane/pull/1299.diff","patch_url":"https://github.com/fastlane/fastlane/pull/1299.patch","issue_url":"https://api.github.com/repos/fastlane/fastlane/issues/1299","number":1299,"state":"open","locked":false,"title":"Added 'update_icloud_container_identifiers' action to change iCloud container identifiers","user":{"login":"JamesKuang","id":1231513,"avatar_url":"https://avatars.githubusercontent.com/u/1231513?v=3","gravatar_id":"","url":"https://api.github.com/users/JamesKuang","html_url":"https://github.com/JamesKuang","followers_url":"https://api.github.com/users/JamesKuang/followers","following_url":"https://api.github.com/users/JamesKuang/following{/other_user}","gists_url":"https://api.github.com/users/JamesKuang/gists{/gist_id}","starred_url":"https://api.github.com/users/JamesKuang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JamesKuang/subscriptions","organizations_url":"https://api.github.com/users/JamesKuang/orgs","repos_url":"https://api.github.com/users/JamesKuang/repos","events_url":"https://api.github.com/users/JamesKuang/events{/privacy}","received_events_url":"https://api.github.com/users/JamesKuang/received_events","type":"User","site_admin":false},"body":"This was inspired by 'update_app_group_identifiers' and works in the same way. Apps that use iCloud containers have the same problem as app groups, as you have to switch entitlements depending on your build environment. This makes it easy to do that for different lanes.","created_at":"2016-02-11T15:19:59Z","updated_at":"2016-02-23T19:19:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dab500ef77c58da6395940dd83f999bc885973bf","assignee":{"login":"asfalcone","id":1848683,"avatar_url":"https://avatars.githubusercontent.com/u/1848683?v=3","gravatar_id":"","url":"https://api.github.com/users/asfalcone","html_url":"https://github.com/asfalcone","followers_url":"https://api.github.com/users/asfalcone/followers","following_url":"https://api.github.com/users/asfalcone/following{/other_user}","gists_url":"https://api.github.com/users/asfalcone/gists{/gist_id}","starred_url":"https://api.github.com/users/asfalcone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asfalcone/subscriptions","organizations_url":"https://api.github.com/users/asfalcone/orgs","repos_url":"https://api.github.com/users/asfalcone/repos","events_url":"https://api.github.com/users/asfalcone/events{/privacy}","received_events_url":"https://api.github.com/users/asfalcone/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/fastlane/fastlane/pulls/1299/commits","review_comments_url":"https://api.github.com/repos/fastlane/fastlane/pulls/1299/comments","review_comment_url":"https://api.github.com/repos/fastlane/fastlane/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fastlane/fastlane/issues/1299/comments","statuses_url":"https://api.github.com/repos/fastlane/fastlane/statuses/855b561ac1ea5e56545d63efd5d92180d148365b","head":{"label":"JamesKuang:master","ref":"master","sha":"855b561ac1ea5e56545d63efd5d92180d148365b","user":{"login":"JamesKuang","id":1231513,"avatar_url":"https://avatars.githubusercontent.com/u/1231513?v=3","gravatar_id":"","url":"https://api.github.com/users/JamesKuang","html_url":"https://github.com/JamesKuang","followers_url":"https://api.github.com/users/JamesKuang/followers","following_url":"https://api.github.com/users/JamesKuang/following{/other_user}","gists_url":"https://api.github.com/users/JamesKuang/gists{/gist_id}","starred_url":"https://api.github.com/users/JamesKuang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JamesKuang/subscriptions","organizations_url":"https://api.github.com/users/JamesKuang/orgs","repos_url":"https://api.github.com/users/JamesKuang/repos","events_url":"https://api.github.com/users/JamesKuang/events{/privacy}","received_events_url":"https://api.github.com/users/JamesKuang/received_events","type":"User","site_admin":false},"repo":{"id":51483569,"name":"fastlane","full_name":"JamesKuang/fastlane","owner":{"login":"JamesKuang","id":1231513,"avatar_url":"https://avatars.githubusercontent.com/u/1231513?v=3","gravatar_id":"","url":"https://api.github.com/users/JamesKuang","html_url":"https://github.com/JamesKuang","followers_url":"https://api.github.com/users/JamesKuang/followers","following_url":"https://api.github.com/users/JamesKuang/following{/other_user}","gists_url":"https://api.github.com/users/JamesKuang/gists{/gist_id}","starred_url":"https://api.github.com/users/JamesKuang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JamesKuang/subscriptions","organizations_url":"https://api.github.com/users/JamesKuang/orgs","repos_url":"https://api.github.com/users/JamesKuang/repos","events_url":"https://api.github.com/users/JamesKuang/events{/privacy}","received_events_url":"https://api.github.com/users/JamesKuang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JamesKuang/fastlane","description":"Connect all iOS deployment tools into one streamlined workflow","fork":true,"url":"https://api.github.com/repos/JamesKuang/fastlane","forks_url":"https://api.github.com/repos/JamesKuang/fastlane/forks","keys_url":"https://api.github.com/repos/JamesKuang/fastlane/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JamesKuang/fastlane/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JamesKuang/fastlane/teams","hooks_url":"https://api.github.com/repos/JamesKuang/fastlane/hooks","issue_events_url":"https://api.github.com/repos/JamesKuang/fastlane/issues/events{/number}","events_url":"https://api.github.com/repos/JamesKuang/fastlane/events","assignees_url":"https://api.github.com/repos/JamesKuang/fastlane/assignees{/user}","branches_url":"https://api.github.com/repos/JamesKuang/fastlane/branches{/branch}","tags_url":"https://api.github.com/repos/JamesKuang/fastlane/tags","blobs_url":"https://api.github.com/repos/JamesKuang/fastlane/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JamesKuang/fastlane/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JamesKuang/fastlane/git/refs{/sha}","trees_url":"https://api.github.com/repos/JamesKuang/fastlane/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JamesKuang/fastlane/statuses/{sha}","languages_url":"https://api.github.com/repos/JamesKuang/fastlane/languages","stargazers_url":"https://api.github.com/repos/JamesKuang/fastlane/stargazers","contributors_url":"https://api.github.com/repos/JamesKuang/fastlane/contributors","subscribers_url":"https://api.github.com/repos/JamesKuang/fastlane/subscribers","subscription_url":"https://api.github.com/repos/JamesKuang/fastlane/subscription","commits_url":"https://api.github.com/repos/JamesKuang/fastlane/commits{/sha}","git_commits_url":"https://api.github.com/repos/JamesKuang/fastlane/git/commits{/sha}","comments_url":"https://api.github.com/repos/JamesKuang/fastlane/comments{/number}","issue_comment_url":"https://api.github.com/repos/JamesKuang/fastlane/issues/comments{/number}","contents_url":"https://api.github.com/repos/JamesKuang/fastlane/contents/{+path}","compare_url":"https://api.github.com/repos/JamesKuang/fastlane/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JamesKuang/fastlane/merges","archive_url":"https://api.github.com/repos/JamesKuang/fastlane/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JamesKuang/fastlane/downloads","issues_url":"https://api.github.com/repos/JamesKuang/fastlane/issues{/number}","pulls_url":"https://api.github.com/repos/JamesKuang/fastlane/pulls{/number}","milestones_url":"https://api.github.com/repos/JamesKuang/fastlane/milestones{/number}","notifications_url":"https://api.github.com/repos/JamesKuang/fastlane/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JamesKuang/fastlane/labels{/name}","releases_url":"https://api.github.com/repos/JamesKuang/fastlane/releases{/id}","deployments_url":"https://api.github.com/repos/JamesKuang/fastlane/deployments","created_at":"2016-02-11T00:20:10Z","updated_at":"2016-02-11T00:20:12Z","pushed_at":"2016-02-12T18:47:42Z","git_url":"git://github.com/JamesKuang/fastlane.git","ssh_url":"git@github.com:JamesKuang/fastlane.git","clone_url":"https://github.com/JamesKuang/fastlane.git","svn_url":"https://github.com/JamesKuang/fastlane","homepage":"https://fastlane.tools","size":3836,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"fastlane:master","ref":"master","sha":"2375d8d77218238333e4e95fff7b8887ef0959ab","user":{"login":"fastlane","id":11098337,"avatar_url":"https://avatars.githubusercontent.com/u/11098337?v=3","gravatar_id":"","url":"https://api.github.com/users/fastlane","html_url":"https://github.com/fastlane","followers_url":"https://api.github.com/users/fastlane/followers","following_url":"https://api.github.com/users/fastlane/following{/other_user}","gists_url":"https://api.github.com/users/fastlane/gists{/gist_id}","starred_url":"https://api.github.com/users/fastlane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fastlane/subscriptions","organizations_url":"https://api.github.com/users/fastlane/orgs","repos_url":"https://api.github.com/users/fastlane/repos","events_url":"https://api.github.com/users/fastlane/events{/privacy}","received_events_url":"https://api.github.com/users/fastlane/received_events","type":"Organization","site_admin":false},"repo":{"id":27442967,"name":"fastlane","full_name":"fastlane/fastlane","owner":{"login":"fastlane","id":11098337,"avatar_url":"https://avatars.githubusercontent.com/u/11098337?v=3","gravatar_id":"","url":"https://api.github.com/users/fastlane","html_url":"https://github.com/fastlane","followers_url":"https://api.github.com/users/fastlane/followers","following_url":"https://api.github.com/users/fastlane/following{/other_user}","gists_url":"https://api.github.com/users/fastlane/gists{/gist_id}","starred_url":"https://api.github.com/users/fastlane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fastlane/subscriptions","organizations_url":"https://api.github.com/users/fastlane/orgs","repos_url":"https://api.github.com/users/fastlane/repos","events_url":"https://api.github.com/users/fastlane/events{/privacy}","received_events_url":"https://api.github.com/users/fastlane/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fastlane/fastlane","description":"Connect all iOS deployment tools into one streamlined workflow","fork":false,"url":"https://api.github.com/repos/fastlane/fastlane","forks_url":"https://api.github.com/repos/fastlane/fastlane/forks","keys_url":"https://api.github.com/repos/fastlane/fastlane/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fastlane/fastlane/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fastlane/fastlane/teams","hooks_url":"https://api.github.com/repos/fastlane/fastlane/hooks","issue_events_url":"https://api.github.com/repos/fastlane/fastlane/issues/events{/number}","events_url":"https://api.github.com/repos/fastlane/fastlane/events","assignees_url":"https://api.github.com/repos/fastlane/fastlane/assignees{/user}","branches_url":"https://api.github.com/repos/fastlane/fastlane/branches{/branch}","tags_url":"https://api.github.com/repos/fastlane/fastlane/tags","blobs_url":"https://api.github.com/repos/fastlane/fastlane/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fastlane/fastlane/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fastlane/fastlane/git/refs{/sha}","trees_url":"https://api.github.com/repos/fastlane/fastlane/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fastlane/fastlane/statuses/{sha}","languages_url":"https://api.github.com/repos/fastlane/fastlane/languages","stargazers_url":"https://api.github.com/repos/fastlane/fastlane/stargazers","contributors_url":"https://api.github.com/repos/fastlane/fastlane/contributors","subscribers_url":"https://api.github.com/repos/fastlane/fastlane/subscribers","subscription_url":"https://api.github.com/repos/fastlane/fastlane/subscription","commits_url":"https://api.github.com/repos/fastlane/fastlane/commits{/sha}","git_commits_url":"https://api.github.com/repos/fastlane/fastlane/git/commits{/sha}","comments_url":"https://api.github.com/repos/fastlane/fastlane/comments{/number}","issue_comment_url":"https://api.github.com/repos/fastlane/fastlane/issues/comments{/number}","contents_url":"https://api.github.com/repos/fastlane/fastlane/contents/{+path}","compare_url":"https://api.github.com/repos/fastlane/fastlane/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fastlane/fastlane/merges","archive_url":"https://api.github.com/repos/fastlane/fastlane/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fastlane/fastlane/downloads","issues_url":"https://api.github.com/repos/fastlane/fastlane/issues{/number}","pulls_url":"https://api.github.com/repos/fastlane/fastlane/pulls{/number}","milestones_url":"https://api.github.com/repos/fastlane/fastlane/milestones{/number}","notifications_url":"https://api.github.com/repos/fastlane/fastlane/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fastlane/fastlane/labels{/name}","releases_url":"https://api.github.com/repos/fastlane/fastlane/releases{/id}","deployments_url":"https://api.github.com/repos/fastlane/fastlane/deployments","created_at":"2014-12-02T17:00:38Z","updated_at":"2016-02-23T17:41:14Z","pushed_at":"2016-02-23T18:48:11Z","git_url":"git://github.com/fastlane/fastlane.git","ssh_url":"git@github.com:fastlane/fastlane.git","clone_url":"https://github.com/fastlane/fastlane.git","svn_url":"https://github.com/fastlane/fastlane","homepage":"https://fastlane.tools","size":6894,"stargazers_count":5777,"watchers_count":5777,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":661,"mirror_url":null,"open_issues_count":232,"forks":661,"open_issues":232,"watchers":5777,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fastlane/fastlane/pulls/1299"},"html":{"href":"https://github.com/fastlane/fastlane/pull/1299"},"issue":{"href":"https://api.github.com/repos/fastlane/fastlane/issues/1299"},"comments":{"href":"https://api.github.com/repos/fastlane/fastlane/issues/1299/comments"},"review_comments":{"href":"https://api.github.com/repos/fastlane/fastlane/pulls/1299/comments"},"review_comment":{"href":"https://api.github.com/repos/fastlane/fastlane/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fastlane/fastlane/pulls/1299/commits"},"statuses":{"href":"https://api.github.com/repos/fastlane/fastlane/statuses/855b561ac1ea5e56545d63efd5d92180d148365b"}}}}