forked from f100024/fastlane-plugin-bitbucket
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from natura-cosmeticos/STEM-3000-fech-changed-…
…files Including bitbucket fetch pull request changed files action
- Loading branch information
Showing
3 changed files
with
111 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
lib/fastlane/plugin/bitbucket/actions/bitbucket_fetch_pull_request_changed_files_action.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
require 'fastlane/action' | ||
require_relative '../helper/bitbucket_helper' | ||
require 'base64' | ||
|
||
|
||
module Fastlane | ||
module Actions | ||
class BitbucketFetchPullRequestChangedFilesAction < Action | ||
def self.run(params) | ||
auth_header = Helper::BitbucketHelper.get_auth_header(params) | ||
|
||
if params[:base_url] then | ||
base_url = params[:base_url] | ||
else | ||
base_url = 'https://api.bitbucket.org' | ||
end | ||
|
||
Helper::BitbucketHelper.fetch_pull_request_changed_files(auth_header, base_url, params[:project_key], params[:repo_slug], params[:request_id]) | ||
end | ||
|
||
def self.description | ||
"This action allows fastlane to fetch the list of modified files in a pull request" | ||
end | ||
|
||
def self.authors | ||
["Ana Ludmila, Daniel Nazareth, Igor Matos, Elize Delabrida"] | ||
end | ||
|
||
def self.return_value | ||
"The return value is the listing of files changed in a pull request" | ||
end | ||
|
||
def self.available_options | ||
[ | ||
FastlaneCore::ConfigItem.new( | ||
key: :base_url, | ||
env_name: "BITBUCKET_BASE_URL", | ||
description: "The base URL for your BitBucket Server, including protocol", | ||
optional: true, | ||
type: String, | ||
verify_block: proc do |value| | ||
UI.user_error!("Bitbucket Server url should use https") unless !!(value.match"^https://") | ||
end | ||
), | ||
FastlaneCore::ConfigItem.new( | ||
key: :project_key, | ||
env_name: "BITBUCKET_PROJECT_KEY", | ||
description: "The Project Key for your repository", | ||
optional: false, | ||
type: String | ||
), | ||
FastlaneCore::ConfigItem.new( | ||
key: :repo_slug, | ||
env_name: "BITBUCKET_REPO_SLUG", | ||
description: "The repository slug for your repository", | ||
optional: false, | ||
type: String | ||
), | ||
FastlaneCore::ConfigItem.new( | ||
key: :access_token, | ||
env_name: "BITBUCKET_PERSONAL_ACCESS_TOKEN", | ||
description: "A Personal Access Token from BitBucket for the account used. One of access_token or basic_creds must be specified; if both are supplied access_token is used", | ||
optional: true, | ||
type: String | ||
), | ||
FastlaneCore::ConfigItem.new( | ||
key: :basic_creds, | ||
env_name: "BITBUCKET_BASIC_AUTH_CREDENTIALS", | ||
description: "To use Basic Auth for Bitbuket provide a base64 encoded version of \"<username>:<password>\". One of access_token or basic_creds must be specified; if both are supplied access_token is used", | ||
optional: true, | ||
type: String | ||
), | ||
FastlaneCore::ConfigItem.new( | ||
key: :request_id, | ||
description: "The Identifier Key For Your Pull Request", | ||
type: Integer, | ||
optional: true | ||
) | ||
] | ||
end | ||
|
||
def self.is_supported?(platform) | ||
true | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters