{"action":"created","comment":{"url":"https://api.github.com/repos/fastlane/fastlane/pulls/comments/49380942","id":49380942,"diff_hunk":"@@ -0,0 +1,134 @@\n+module Fastlane\n+  module Actions\n+    module SharedValues\n+      VERSION_FROM_LAST_TAG = :VERSION_FROM_LAST_TAG\n+    end\n+\n+    # To share this integration with the other fastlane users:\n+    # - Fork https://github.com/KrauseFx/fastlane\n+    # - Clone the forked repository\n+    # - Move this integration into lib/fastlane/actions\n+    # - Commit, push and submit the pull request\n+\n+    class VersionFromLastTagAction < Action\n+      def self.run(params)\n+        version_to_return = \"#{params[:default_version]}\"\n+        regex = \"#{params[:regex]}\"\n+\n+        # If there are remotes fetch tags\n+        remote_count = sh(\"git remote show | wc -l\")\n+        if remote_count > 0.to_s\n+          sh(\"git fetch --tags\")\n+        end\n+\n+        # Count the tags\n+        tag_count = sh(\"git show-ref --tags | wc -l\")\n+\n+        # If we have more than 1 tag try to parse\n+        if tag_count.to_i > 0","path":"lib/fastlane/actions/version_from_last_tag.rb","position":28,"original_position":28,"commit_id":"afe80c0203fdbe53717c68ffa06bc77853866957","original_commit_id":"afe80c0203fdbe53717c68ffa06bc77853866957","user":{"login":"KrauseFx","id":869950,"avatar_url":"https://avatars.githubusercontent.com/u/869950?v=3","gravatar_id":"","url":"https://api.github.com/users/KrauseFx","html_url":"https://github.com/KrauseFx","followers_url":"https://api.github.com/users/KrauseFx/followers","following_url":"https://api.github.com/users/KrauseFx/following{/other_user}","gists_url":"https://api.github.com/users/KrauseFx/gists{/gist_id}","starred_url":"https://api.github.com/users/KrauseFx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KrauseFx/subscriptions","organizations_url":"https://api.github.com/users/KrauseFx/orgs","repos_url":"https://api.github.com/users/KrauseFx/repos","events_url":"https://api.github.com/users/KrauseFx/events{/privacy}","received_events_url":"https://api.github.com/users/KrauseFx/received_events","type":"User","site_admin":false},"body":"Oh, it already does that? ","created_at":"2016-01-11T21:25:29Z","updated_at":"2016-01-11T21:25:29Z","html_url":"https://github.com/fastlane/fastlane/pull/1054#discussion_r49380942","pull_request_url":"https://api.github.com/repos/fastlane/fastlane/pulls/1054","_links":{"self":{"href":"https://api.github.com/repos/fastlane/fastlane/pulls/comments/49380942"},"html":{"href":"https://github.com/fastlane/fastlane/pull/1054#discussion_r49380942"},"pull_request":{"href":"https://api.github.com/repos/fastlane/fastlane/pulls/1054"}}},"pull_request":{"url":"https://api.github.com/repos/fastlane/fastlane/pulls/1054","id":55111917,"html_url":"https://github.com/fastlane/fastlane/pull/1054","diff_url":"https://github.com/fastlane/fastlane/pull/1054.diff","patch_url":"https://github.com/fastlane/fastlane/pull/1054.patch","issue_url":"https://api.github.com/repos/fastlane/fastlane/issues/1054","number":1054,"state":"open","locked":false,"title":"New Action: VERSION_FROM_LAST_TAG (parses version numbers with regex from last git tag)","user":{"login":"jeeftor","id":6491743,"avatar_url":"https://avatars.githubusercontent.com/u/6491743?v=3","gravatar_id":"","url":"https://api.github.com/users/jeeftor","html_url":"https://github.com/jeeftor","followers_url":"https://api.github.com/users/jeeftor/followers","following_url":"https://api.github.com/users/jeeftor/following{/other_user}","gists_url":"https://api.github.com/users/jeeftor/gists{/gist_id}","starred_url":"https://api.github.com/users/jeeftor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeeftor/subscriptions","organizations_url":"https://api.github.com/users/jeeftor/orgs","repos_url":"https://api.github.com/users/jeeftor/repos","events_url":"https://api.github.com/users/jeeftor/events{/privacy}","received_events_url":"https://api.github.com/users/jeeftor/received_events","type":"User","site_admin":false},"body":"    +----------------------------------------------------------------------------------------+\r\n    |                                 version_from_last_tag                                  |\r\n    +----------------------------------------------------------------------------------------+\r\n    | Fetchs the latest git tag and parses version info in the form of (anything)0.0.0       |\r\n    |                                                                                        |\r\n    | This action is designed specificlaly for cases where your repo was shallow cloned      |\r\n    | It will fetch the last branch tag and try to parse it using a regex.  The default      |\r\n    | regex format is ^\\D+([\\.0-9]*)                                                         |\r\n    |                                                                                        |\r\n    |                                                                                        |\r\n    | It will look for a sequence of non-digets and then at the first digit it will capture  |\r\n    | any of the following characters:    0 1 2 3 4 5 6 7 8 9 .                              |\r\n    |                                                                                        |\r\n    | So for example                                                                         |\r\n    |   release-1.2   => 1.2                                                                 |\r\n    |   v1.0          => 1.0                                                                 |\r\n    |   version1      => 1                                                                   |\r\n    |   version 1.2.3 => 1.2.3                                                               |\r\n    |                                                                                        |\r\n    | Created by Jeeftor                                                                     |\r\n    +----------------------------------------------------------------------------------------+\r\n\r\n\r\nThis action will run a regex on the last git tag and attempt to parse out a version number.  If you are using release tagging this is a useful function .\r\n\r\n\r\n* If the regex passes it will extract tag info\r\n* if there is a regex error it will use the default version string\r\n* if it cannot extract tag info it will use the default version string\r\n* if it has not tags it will use the default version string","created_at":"2016-01-05T16:33:22Z","updated_at":"2016-01-11T21:25:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fc7994fae72c6886a6b8f6994bd5f08213456d8c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fastlane/fastlane/pulls/1054/commits","review_comments_url":"https://api.github.com/repos/fastlane/fastlane/pulls/1054/comments","review_comment_url":"https://api.github.com/repos/fastlane/fastlane/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fastlane/fastlane/issues/1054/comments","statuses_url":"https://api.github.com/repos/fastlane/fastlane/statuses/afe80c0203fdbe53717c68ffa06bc77853866957","head":{"label":"jeeftor:version_from_last_tag","ref":"version_from_last_tag","sha":"afe80c0203fdbe53717c68ffa06bc77853866957","user":{"login":"jeeftor","id":6491743,"avatar_url":"https://avatars.githubusercontent.com/u/6491743?v=3","gravatar_id":"","url":"https://api.github.com/users/jeeftor","html_url":"https://github.com/jeeftor","followers_url":"https://api.github.com/users/jeeftor/followers","following_url":"https://api.github.com/users/jeeftor/following{/other_user}","gists_url":"https://api.github.com/users/jeeftor/gists{/gist_id}","starred_url":"https://api.github.com/users/jeeftor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeeftor/subscriptions","organizations_url":"https://api.github.com/users/jeeftor/orgs","repos_url":"https://api.github.com/users/jeeftor/repos","events_url":"https://api.github.com/users/jeeftor/events{/privacy}","received_events_url":"https://api.github.com/users/jeeftor/received_events","type":"User","site_admin":false},"repo":{"id":48317171,"name":"fastlane","full_name":"jeeftor/fastlane","owner":{"login":"jeeftor","id":6491743,"avatar_url":"https://avatars.githubusercontent.com/u/6491743?v=3","gravatar_id":"","url":"https://api.github.com/users/jeeftor","html_url":"https://github.com/jeeftor","followers_url":"https://api.github.com/users/jeeftor/followers","following_url":"https://api.github.com/users/jeeftor/following{/other_user}","gists_url":"https://api.github.com/users/jeeftor/gists{/gist_id}","starred_url":"https://api.github.com/users/jeeftor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeeftor/subscriptions","organizations_url":"https://api.github.com/users/jeeftor/orgs","repos_url":"https://api.github.com/users/jeeftor/repos","events_url":"https://api.github.com/users/jeeftor/events{/privacy}","received_events_url":"https://api.github.com/users/jeeftor/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jeeftor/fastlane","description":"Connect all iOS deployment tools into one streamlined workflow","fork":true,"url":"https://api.github.com/repos/jeeftor/fastlane","forks_url":"https://api.github.com/repos/jeeftor/fastlane/forks","keys_url":"https://api.github.com/repos/jeeftor/fastlane/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jeeftor/fastlane/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jeeftor/fastlane/teams","hooks_url":"https://api.github.com/repos/jeeftor/fastlane/hooks","issue_events_url":"https://api.github.com/repos/jeeftor/fastlane/issues/events{/number}","events_url":"https://api.github.com/repos/jeeftor/fastlane/events","assignees_url":"https://api.github.com/repos/jeeftor/fastlane/assignees{/user}","branches_url":"https://api.github.com/repos/jeeftor/fastlane/branches{/branch}","tags_url":"https://api.github.com/repos/jeeftor/fastlane/tags","blobs_url":"https://api.github.com/repos/jeeftor/fastlane/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jeeftor/fastlane/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jeeftor/fastlane/git/refs{/sha}","trees_url":"https://api.github.com/repos/jeeftor/fastlane/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jeeftor/fastlane/statuses/{sha}","languages_url":"https://api.github.com/repos/jeeftor/fastlane/languages","stargazers_url":"https://api.github.com/repos/jeeftor/fastlane/stargazers","contributors_url":"https://api.github.com/repos/jeeftor/fastlane/contributors","subscribers_url":"https://api.github.com/repos/jeeftor/fastlane/subscribers","subscription_url":"https://api.github.com/repos/jeeftor/fastlane/subscription","commits_url":"https://api.github.com/repos/jeeftor/fastlane/commits{/sha}","git_commits_url":"https://api.github.com/repos/jeeftor/fastlane/git/commits{/sha}","comments_url":"https://api.github.com/repos/jeeftor/fastlane/comments{/number}","issue_comment_url":"https://api.github.com/repos/jeeftor/fastlane/issues/comments{/number}","contents_url":"https://api.github.com/repos/jeeftor/fastlane/contents/{+path}","compare_url":"https://api.github.com/repos/jeeftor/fastlane/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jeeftor/fastlane/merges","archive_url":"https://api.github.com/repos/jeeftor/fastlane/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jeeftor/fastlane/downloads","issues_url":"https://api.github.com/repos/jeeftor/fastlane/issues{/number}","pulls_url":"https://api.github.com/repos/jeeftor/fastlane/pulls{/number}","milestones_url":"https://api.github.com/repos/jeeftor/fastlane/milestones{/number}","notifications_url":"https://api.github.com/repos/jeeftor/fastlane/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jeeftor/fastlane/labels{/name}","releases_url":"https://api.github.com/repos/jeeftor/fastlane/releases{/id}","created_at":"2015-12-20T11:13:01Z","updated_at":"2015-12-20T11:13:03Z","pushed_at":"2016-01-06T01:11:05Z","git_url":"git://github.com/jeeftor/fastlane.git","ssh_url":"git@github.com:jeeftor/fastlane.git","clone_url":"https://github.com/jeeftor/fastlane.git","svn_url":"https://github.com/jeeftor/fastlane","homepage":"https://fastlane.tools","size":3490,"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":"e3b4704b68b94f5863e124ae1ccfe0bae92e503e","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}","created_at":"2014-12-02T17:00:38Z","updated_at":"2016-01-11T20:17:56Z","pushed_at":"2016-01-11T19:00:21Z","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":5946,"stargazers_count":5067,"watchers_count":5067,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":542,"mirror_url":null,"open_issues_count":188,"forks":542,"open_issues":188,"watchers":5067,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fastlane/fastlane/pulls/1054"},"html":{"href":"https://github.com/fastlane/fastlane/pull/1054"},"issue":{"href":"https://api.github.com/repos/fastlane/fastlane/issues/1054"},"comments":{"href":"https://api.github.com/repos/fastlane/fastlane/issues/1054/comments"},"review_comments":{"href":"https://api.github.com/repos/fastlane/fastlane/pulls/1054/comments"},"review_comment":{"href":"https://api.github.com/repos/fastlane/fastlane/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fastlane/fastlane/pulls/1054/commits"},"statuses":{"href":"https://api.github.com/repos/fastlane/fastlane/statuses/afe80c0203fdbe53717c68ffa06bc77853866957"}}}}