fastlane-plugin-circle_ci 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +272 -3
- data/lib/fastlane/plugin/circle_ci/actions/circleci_add_context_env_var.rb +117 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_add_project_collaborator.rb +109 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_approve_job.rb +95 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_cancel_job.rb +96 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_cancel_workflow.rb +85 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_continue_pipeline.rb +104 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_create_checkout_key.rb +110 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_create_pipeline_definition.rb +126 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_create_pipeline_definition_trigger.rb +133 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_create_pipeline_schedule.rb +160 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_create_project.rb +105 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_create_webhook.rb +155 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_delete_checkout_key.rb +93 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_delete_context_env_var.rb +110 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_delete_env_var.rb +86 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_delete_pipeline_definition.rb +91 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_delete_pipeline_schedule.rb +95 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_delete_trigger.rb +92 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_delete_webhook.rb +86 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_download_artifact.rb +119 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_download_workflow_artifacts.rb +400 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_checkout_key.rb +101 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_checkout_keys.rb +96 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_context_env_vars.rb +114 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_env_vars.rb +95 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_flaky_tests.rb +99 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_job_artifacts.rb +111 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_job_details.rb +110 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_job_tests.rb +111 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_job_timeseries.rb +131 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_my_pipelines.rb +100 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_org_summary.rb +113 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_pipeline.rb +104 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_pipeline_by_number.rb +105 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_pipeline_config.rb +92 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_pipeline_definition.rb +99 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_pipeline_definitions.rb +94 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_pipeline_values.rb +91 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_pipeline_workflows.rb +108 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_project_branches.rb +105 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_project_config.rb +104 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_project_workflow_metrics.rb +121 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_trigger.rb +99 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_user_info.rb +83 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_workflow.rb +121 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_workflow_insights.rb +157 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_workflow_job_metrics.rb +123 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_workflow_jobs.rb +109 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_workflow_runs.rb +129 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_workflow_summary.rb +118 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_get_workflow_test_metrics.rb +115 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_list_all_pipelines.rb +94 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_list_contexts.rb +132 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_list_pipeline_definition_triggers.rb +101 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_list_pipeline_schedules.rb +99 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_list_projects.rb +89 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_list_webhooks.rb +111 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_rerun_workflow.rb +101 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_set_env_var.rb +102 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_trigger_pipeline.rb +130 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_update_pipeline_definition.rb +127 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_update_pipeline_schedule.rb +134 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_update_trigger.rb +114 -0
- data/lib/fastlane/plugin/circle_ci/actions/circleci_wait_for_pipeline.rb +152 -0
- data/lib/fastlane/plugin/circle_ci/helper/circle_ci_helper.rb +102 -1
- data/lib/fastlane/plugin/circle_ci/version.rb +1 -1
- metadata +99 -7
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/circle_ci_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
module SharedValues
|
7
|
+
CIRCLECI_PIPELINE_DEFINITION = :CIRCLECI_PIPELINE_DEFINITION
|
8
|
+
end
|
9
|
+
|
10
|
+
class CircleciGetPipelineDefinitionAction < Action
|
11
|
+
def self.run(params)
|
12
|
+
UI.message("Getting CircleCI pipeline definition via API v2...")
|
13
|
+
|
14
|
+
api_token = params[:api_token]
|
15
|
+
project_id = params[:project_id]
|
16
|
+
pipeline_definition_id = params[:pipeline_definition_id]
|
17
|
+
|
18
|
+
# Make API request
|
19
|
+
result = Helper::CircleCiHelper.get_v2("projects/#{project_id}/pipeline-definitions/#{pipeline_definition_id}", api_token)
|
20
|
+
|
21
|
+
# Store values in lane context
|
22
|
+
Actions.lane_context[SharedValues::CIRCLECI_PIPELINE_DEFINITION] = result
|
23
|
+
|
24
|
+
UI.success("Successfully retrieved pipeline definition with ID #{pipeline_definition_id}")
|
25
|
+
|
26
|
+
return result
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.description
|
30
|
+
"Gets a specific pipeline definition using CircleCI API v2"
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.details
|
34
|
+
"This action retrieves details for a specific pipeline definition using the CircleCI API v2. Pipeline definitions describe how pipelines are configured for a project."
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.available_options
|
38
|
+
[
|
39
|
+
FastlaneCore::ConfigItem.new(key: :api_token,
|
40
|
+
env_name: "CIRCLE_CI_API_TOKEN",
|
41
|
+
description: "API Token for CircleCI API",
|
42
|
+
sensitive: true,
|
43
|
+
code_gen_sensitive: true,
|
44
|
+
is_string: true,
|
45
|
+
default_value: ENV["CIRCLE_CI_API_TOKEN"],
|
46
|
+
default_value_dynamic: true,
|
47
|
+
optional: false),
|
48
|
+
FastlaneCore::ConfigItem.new(key: :project_id,
|
49
|
+
env_name: "CIRCLE_CI_PROJECT_ID",
|
50
|
+
description: "The ID of the CircleCI project",
|
51
|
+
is_string: true,
|
52
|
+
optional: false),
|
53
|
+
FastlaneCore::ConfigItem.new(key: :pipeline_definition_id,
|
54
|
+
description: "The ID of the pipeline definition to retrieve",
|
55
|
+
is_string: true,
|
56
|
+
optional: false)
|
57
|
+
]
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.output
|
61
|
+
[
|
62
|
+
['CIRCLECI_PIPELINE_DEFINITION', 'A hash containing pipeline definition information']
|
63
|
+
]
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.return_value
|
67
|
+
"Returns a hash containing pipeline definition information."
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.authors
|
71
|
+
["crazymanish", "copilot"]
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.example_code
|
75
|
+
[
|
76
|
+
'circleci_get_pipeline_definition(
|
77
|
+
project_id: "01234567-89ab-cdef-0123-456789abcdef",
|
78
|
+
pipeline_definition_id: "fedcba98-7654-3210-fedc-ba9876543210"
|
79
|
+
)',
|
80
|
+
'definition = circleci_get_pipeline_definition(
|
81
|
+
project_id: "01234567-89ab-cdef-0123-456789abcdef",
|
82
|
+
pipeline_definition_id: "fedcba98-7654-3210-fedc-ba9876543210"
|
83
|
+
)
|
84
|
+
|
85
|
+
# Use the pipeline definition information
|
86
|
+
UI.message("Definition Name: #{definition["name"]}, Created At: #{definition["created_at"]}")'
|
87
|
+
]
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.is_supported?(platform)
|
91
|
+
true
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.category
|
95
|
+
:ci
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/circle_ci_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
module SharedValues
|
7
|
+
CIRCLECI_PIPELINE_DEFINITIONS = :CIRCLECI_PIPELINE_DEFINITIONS
|
8
|
+
end
|
9
|
+
|
10
|
+
class CircleciGetPipelineDefinitionsAction < Action
|
11
|
+
def self.run(params)
|
12
|
+
UI.message("Getting CircleCI pipeline definitions via API v2...")
|
13
|
+
|
14
|
+
api_token = params[:api_token]
|
15
|
+
project_id = params[:project_id]
|
16
|
+
|
17
|
+
# Make API request
|
18
|
+
result = Helper::CircleCiHelper.get_v2("projects/#{project_id}/pipeline-definitions", api_token)
|
19
|
+
|
20
|
+
# Store values in lane context
|
21
|
+
Actions.lane_context[SharedValues::CIRCLECI_PIPELINE_DEFINITIONS] = result
|
22
|
+
|
23
|
+
UI.success("Successfully retrieved pipeline definitions for project #{project_id}")
|
24
|
+
|
25
|
+
return result
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.description
|
29
|
+
"Gets pipeline definitions for a CircleCI project using API v2"
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.details
|
33
|
+
"This action retrieves all pipeline definitions for a specific CircleCI project using the CircleCI API v2. Pipeline definitions describe how pipelines are configured for a project."
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.available_options
|
37
|
+
[
|
38
|
+
FastlaneCore::ConfigItem.new(key: :api_token,
|
39
|
+
env_name: "CIRCLE_CI_API_TOKEN",
|
40
|
+
description: "API Token for CircleCI API",
|
41
|
+
sensitive: true,
|
42
|
+
code_gen_sensitive: true,
|
43
|
+
is_string: true,
|
44
|
+
default_value: ENV["CIRCLE_CI_API_TOKEN"],
|
45
|
+
default_value_dynamic: true,
|
46
|
+
optional: false),
|
47
|
+
FastlaneCore::ConfigItem.new(key: :project_id,
|
48
|
+
env_name: "CIRCLE_CI_PROJECT_ID",
|
49
|
+
description: "The ID of the CircleCI project",
|
50
|
+
is_string: true,
|
51
|
+
optional: false)
|
52
|
+
]
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.output
|
56
|
+
[
|
57
|
+
['CIRCLECI_PIPELINE_DEFINITIONS', 'A hash containing pipeline definitions information']
|
58
|
+
]
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.return_value
|
62
|
+
"Returns a hash containing pipeline definitions information."
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.authors
|
66
|
+
["crazymanish", "copilot"]
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.example_code
|
70
|
+
[
|
71
|
+
'circleci_get_pipeline_definitions(
|
72
|
+
project_id: "01234567-89ab-cdef-0123-456789abcdef"
|
73
|
+
)',
|
74
|
+
'definitions = circleci_get_pipeline_definitions(
|
75
|
+
project_id: "01234567-89ab-cdef-0123-456789abcdef"
|
76
|
+
)
|
77
|
+
|
78
|
+
# Use the pipeline definitions information
|
79
|
+
definitions["items"].each do |definition|
|
80
|
+
UI.message("Definition ID: #{definition["id"]}, Name: #{definition["name"]}")
|
81
|
+
end'
|
82
|
+
]
|
83
|
+
end
|
84
|
+
|
85
|
+
def self.is_supported?(platform)
|
86
|
+
true
|
87
|
+
end
|
88
|
+
|
89
|
+
def self.category
|
90
|
+
:ci
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/circle_ci_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
module SharedValues
|
7
|
+
CIRCLECI_PIPELINE_VALUES = :CIRCLECI_PIPELINE_VALUES
|
8
|
+
end
|
9
|
+
|
10
|
+
class CircleciGetPipelineValuesAction < Action
|
11
|
+
def self.run(params)
|
12
|
+
UI.message("Getting CircleCI pipeline values via API v2...")
|
13
|
+
|
14
|
+
api_token = params[:api_token]
|
15
|
+
pipeline_id = params[:pipeline_id]
|
16
|
+
|
17
|
+
# Make API request
|
18
|
+
result = Helper::CircleCiHelper.get_v2("pipeline/#{pipeline_id}/values", api_token)
|
19
|
+
|
20
|
+
# Store values in lane context
|
21
|
+
Actions.lane_context[SharedValues::CIRCLECI_PIPELINE_VALUES] = result
|
22
|
+
|
23
|
+
UI.success("Successfully retrieved values for pipeline #{pipeline_id}")
|
24
|
+
|
25
|
+
return result
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.description
|
29
|
+
"Gets values (parameters, configurations) for a CircleCI pipeline using API v2"
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.details
|
33
|
+
"This action retrieves all values for a specific CircleCI pipeline using the CircleCI API v2. Values include parameters, configurations, and other metadata about the pipeline."
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.available_options
|
37
|
+
[
|
38
|
+
FastlaneCore::ConfigItem.new(key: :api_token,
|
39
|
+
env_name: "CIRCLE_CI_API_TOKEN",
|
40
|
+
description: "API Token for CircleCI API",
|
41
|
+
sensitive: true,
|
42
|
+
code_gen_sensitive: true,
|
43
|
+
is_string: true,
|
44
|
+
default_value: ENV["CIRCLE_CI_API_TOKEN"],
|
45
|
+
default_value_dynamic: true,
|
46
|
+
optional: false),
|
47
|
+
FastlaneCore::ConfigItem.new(key: :pipeline_id,
|
48
|
+
description: "The ID of the pipeline to retrieve values for",
|
49
|
+
is_string: true,
|
50
|
+
optional: false)
|
51
|
+
]
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.output
|
55
|
+
[
|
56
|
+
['CIRCLECI_PIPELINE_VALUES', 'A hash containing the pipeline values information']
|
57
|
+
]
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.return_value
|
61
|
+
"Returns a hash containing pipeline values information."
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.authors
|
65
|
+
["crazymanish", "copilot"]
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.example_code
|
69
|
+
[
|
70
|
+
'circleci_get_pipeline_values(
|
71
|
+
pipeline_id: "01234567-89ab-cdef-0123-456789abcdef"
|
72
|
+
)',
|
73
|
+
'values = circleci_get_pipeline_values(
|
74
|
+
pipeline_id: "01234567-89ab-cdef-0123-456789abcdef"
|
75
|
+
)
|
76
|
+
|
77
|
+
# Use the pipeline values information
|
78
|
+
UI.message("Pipeline parameters: #{values["parameters"]}")'
|
79
|
+
]
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.is_supported?(platform)
|
83
|
+
true
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.category
|
87
|
+
:ci
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/circle_ci_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
module SharedValues
|
7
|
+
CIRCLECI_PIPELINE_WORKFLOWS = :CIRCLECI_PIPELINE_WORKFLOWS
|
8
|
+
end
|
9
|
+
|
10
|
+
class CircleciGetPipelineWorkflowsAction < Action
|
11
|
+
def self.run(params)
|
12
|
+
UI.message("Getting workflows for CircleCI pipeline via API v2...")
|
13
|
+
|
14
|
+
api_token = params[:api_token]
|
15
|
+
pipeline_id = params[:pipeline_id]
|
16
|
+
|
17
|
+
# Make API request
|
18
|
+
result = Helper::CircleCiHelper.get_v2("pipeline/#{pipeline_id}/workflow", api_token)
|
19
|
+
|
20
|
+
# Store values in lane context
|
21
|
+
Actions.lane_context[SharedValues::CIRCLECI_PIPELINE_WORKFLOWS] = result["items"]
|
22
|
+
|
23
|
+
UI.success("Successfully retrieved #{result["items"].count} workflows for pipeline #{pipeline_id}")
|
24
|
+
|
25
|
+
return result["items"]
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.description
|
29
|
+
"Gets workflows for a CircleCI pipeline using API v2"
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.details
|
33
|
+
"This action retrieves all workflows for a specific CircleCI pipeline using the CircleCI API v2, including status, IDs, and names."
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.available_options
|
37
|
+
[
|
38
|
+
FastlaneCore::ConfigItem.new(key: :api_token,
|
39
|
+
env_name: "CIRCLE_CI_API_TOKEN",
|
40
|
+
description: "API Token for CircleCI API",
|
41
|
+
sensitive: true,
|
42
|
+
code_gen_sensitive: true,
|
43
|
+
is_string: true,
|
44
|
+
default_value: ENV["CIRCLE_CI_API_TOKEN"],
|
45
|
+
default_value_dynamic: true,
|
46
|
+
optional: false),
|
47
|
+
FastlaneCore::ConfigItem.new(key: :pipeline_id,
|
48
|
+
env_name: "CIRCLE_CI_PIPELINE_ID",
|
49
|
+
description: "The ID of the pipeline to get workflows for",
|
50
|
+
is_string: true,
|
51
|
+
optional: false)
|
52
|
+
]
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.output
|
56
|
+
[
|
57
|
+
['CIRCLECI_PIPELINE_WORKFLOWS', 'An array of workflow data for the pipeline']
|
58
|
+
]
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.return_value
|
62
|
+
"Returns an array of workflow data including IDs, names, and status information."
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.authors
|
66
|
+
["crazymanish", "copilot"]
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.example_code
|
70
|
+
[
|
71
|
+
'circleci_get_pipeline_workflows(
|
72
|
+
pipeline_id: "pipeline-uuid"
|
73
|
+
)',
|
74
|
+
'workflows = circleci_get_pipeline_workflows(
|
75
|
+
pipeline_id: "pipeline-uuid"
|
76
|
+
)
|
77
|
+
|
78
|
+
# Find workflows by status
|
79
|
+
running_workflows = workflows.select { |w| w["status"] == "running" }
|
80
|
+
|
81
|
+
if running_workflows.any?
|
82
|
+
UI.message("There are #{running_workflows.count} workflows still running in this pipeline")
|
83
|
+
running_workflows.each do |workflow|
|
84
|
+
puts " - #{workflow["name"]}: #{workflow["status"]}"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
# Find a specific workflow
|
89
|
+
deploy_workflow = workflows.find { |w| w["name"] == "deploy" }
|
90
|
+
if deploy_workflow
|
91
|
+
# Get jobs for the deploy workflow
|
92
|
+
jobs = circleci_get_workflow_jobs(
|
93
|
+
workflow_id: deploy_workflow["id"]
|
94
|
+
)
|
95
|
+
end'
|
96
|
+
]
|
97
|
+
end
|
98
|
+
|
99
|
+
def self.is_supported?(platform)
|
100
|
+
true
|
101
|
+
end
|
102
|
+
|
103
|
+
def self.category
|
104
|
+
:ci
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/circle_ci_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
module SharedValues
|
7
|
+
CIRCLECI_PROJECT_BRANCHES = :CIRCLECI_PROJECT_BRANCHES
|
8
|
+
end
|
9
|
+
|
10
|
+
class CircleciGetProjectBranchesAction < Action
|
11
|
+
def self.run(params)
|
12
|
+
UI.message("Getting all branches for CircleCI project via Insights API v2...")
|
13
|
+
|
14
|
+
api_token = params[:api_token]
|
15
|
+
project_slug = params[:project_slug]
|
16
|
+
|
17
|
+
# Build query parameters
|
18
|
+
query_params = {}
|
19
|
+
query_params["reporting-window"] = params[:reporting_window] if params[:reporting_window]
|
20
|
+
|
21
|
+
# Make API request
|
22
|
+
result = Helper::CircleCiHelper.get_v2("insights/#{project_slug}/branches", api_token, query_params)
|
23
|
+
|
24
|
+
# Store values in lane context
|
25
|
+
Actions.lane_context[SharedValues::CIRCLECI_PROJECT_BRANCHES] = result
|
26
|
+
|
27
|
+
UI.success("Successfully retrieved all branches for project #{project_slug}")
|
28
|
+
|
29
|
+
return result
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.description
|
33
|
+
"Gets all branches for a CircleCI project using Insights API v2"
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.details
|
37
|
+
"This action retrieves a list of all branches for a specified CircleCI project using the Insights API v2. The list will only contain branches currently available within Insights. The maximum number of branches returned is 5,000."
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.available_options
|
41
|
+
[
|
42
|
+
FastlaneCore::ConfigItem.new(key: :api_token,
|
43
|
+
env_name: "CIRCLE_CI_API_TOKEN",
|
44
|
+
description: "API Token for CircleCI API",
|
45
|
+
sensitive: true,
|
46
|
+
code_gen_sensitive: true,
|
47
|
+
is_string: true,
|
48
|
+
default_value: ENV["CIRCLE_CI_API_TOKEN"],
|
49
|
+
default_value_dynamic: true,
|
50
|
+
optional: false),
|
51
|
+
FastlaneCore::ConfigItem.new(key: :project_slug,
|
52
|
+
env_name: "CIRCLE_CI_PROJECT_SLUG",
|
53
|
+
description: "Project slug in the form of :vcs-type/:org-name/:project-name (e.g. github/myorg/myrepo)",
|
54
|
+
is_string: true,
|
55
|
+
default_value: ENV["CIRCLE_CI_PROJECT_SLUG"],
|
56
|
+
default_value_dynamic: true,
|
57
|
+
optional: false),
|
58
|
+
FastlaneCore::ConfigItem.new(key: :reporting_window,
|
59
|
+
description: "The time window used to calculate summary metrics (last-24-hours, last-7-days, last-90-days, etc.)",
|
60
|
+
is_string: true,
|
61
|
+
optional: true)
|
62
|
+
]
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.output
|
66
|
+
[
|
67
|
+
['CIRCLECI_PROJECT_BRANCHES', 'A hash containing all branches information for the project']
|
68
|
+
]
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.return_value
|
72
|
+
"Returns a hash containing all branches information for the project."
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.authors
|
76
|
+
["crazymanish", "copilot"]
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.example_code
|
80
|
+
[
|
81
|
+
'circleci_get_project_branches(
|
82
|
+
project_slug: "gh/MyOrg/my-project"
|
83
|
+
)',
|
84
|
+
'branches = circleci_get_project_branches(
|
85
|
+
project_slug: "gh/MyOrg/my-project",
|
86
|
+
reporting_window: "last-90-days"
|
87
|
+
)
|
88
|
+
|
89
|
+
# Access the branch information
|
90
|
+
branches["items"].each do |branch|
|
91
|
+
UI.message("Branch: #{branch["name"]}")
|
92
|
+
end'
|
93
|
+
]
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.is_supported?(platform)
|
97
|
+
true
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.category
|
101
|
+
:ci
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/circle_ci_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
module SharedValues
|
7
|
+
CIRCLECI_PROJECT_CONFIG = :CIRCLECI_PROJECT_CONFIG
|
8
|
+
end
|
9
|
+
|
10
|
+
class CircleciGetProjectConfigAction < Action
|
11
|
+
def self.run(params)
|
12
|
+
UI.message("Getting CircleCI project configuration via API v2...")
|
13
|
+
|
14
|
+
api_token = params[:api_token]
|
15
|
+
project_slug = params[:project_slug]
|
16
|
+
|
17
|
+
# Make API request
|
18
|
+
result = Helper::CircleCiHelper.get_v2("project/#{project_slug}/config", api_token)
|
19
|
+
|
20
|
+
# Store values in lane context
|
21
|
+
Actions.lane_context[SharedValues::CIRCLECI_PROJECT_CONFIG] = result
|
22
|
+
|
23
|
+
UI.success("Successfully retrieved configuration for project #{project_slug}")
|
24
|
+
|
25
|
+
return result
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.description
|
29
|
+
"Gets the configuration for a CircleCI project using API v2"
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.details
|
33
|
+
"This action retrieves configuration information for a specific CircleCI project using the CircleCI API v2, including compiled YAML configuration."
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.available_options
|
37
|
+
[
|
38
|
+
FastlaneCore::ConfigItem.new(key: :api_token,
|
39
|
+
env_name: "CIRCLE_CI_API_TOKEN",
|
40
|
+
description: "API Token for CircleCI API",
|
41
|
+
sensitive: true,
|
42
|
+
code_gen_sensitive: true,
|
43
|
+
is_string: true,
|
44
|
+
default_value: ENV["CIRCLE_CI_API_TOKEN"],
|
45
|
+
default_value_dynamic: true,
|
46
|
+
optional: false),
|
47
|
+
FastlaneCore::ConfigItem.new(key: :project_slug,
|
48
|
+
env_name: "CIRCLE_CI_PROJECT_SLUG",
|
49
|
+
description: "Project slug in the form of :vcs-type/:org-name/:project-name (e.g. github/myorg/myrepo)",
|
50
|
+
is_string: true,
|
51
|
+
optional: false)
|
52
|
+
]
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.output
|
56
|
+
[
|
57
|
+
['CIRCLECI_PROJECT_CONFIG', 'A hash containing the project configuration details']
|
58
|
+
]
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.return_value
|
62
|
+
"Returns a hash containing project configuration information including compiled YAML configuration."
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.authors
|
66
|
+
["crazymanish", "copilot"]
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.example_code
|
70
|
+
[
|
71
|
+
'circleci_get_project_config(
|
72
|
+
project_slug: "github/myorg/myrepo"
|
73
|
+
)',
|
74
|
+
'config = circleci_get_project_config(
|
75
|
+
project_slug: "github/myorg/myrepo"
|
76
|
+
)
|
77
|
+
|
78
|
+
# Check the configuration source type
|
79
|
+
if config["source"] == "local"
|
80
|
+
UI.message("Project uses a local config file")
|
81
|
+
else
|
82
|
+
UI.message("Project uses a #{config["source"]} config")
|
83
|
+
end
|
84
|
+
|
85
|
+
# Get compiled configuration
|
86
|
+
compiled_config = config["compiled"]
|
87
|
+
|
88
|
+
# Look for specific workflows or jobs
|
89
|
+
if compiled_config && compiled_config.include?("publish-workflow")
|
90
|
+
UI.message("Found publish workflow in the configuration")
|
91
|
+
end'
|
92
|
+
]
|
93
|
+
end
|
94
|
+
|
95
|
+
def self.is_supported?(platform)
|
96
|
+
true
|
97
|
+
end
|
98
|
+
|
99
|
+
def self.category
|
100
|
+
:ci
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|