Method: Gitlab::Triage::Engine#process_summary

Defined in:
lib/gitlab/triage/engine.rb

#process_summary(resource_type, summary_definition) ⇒ nil (private)

Process a summary_definition.

Examples:

Example of a summary definition hash (shown as YAML for readability).


name: Newest and oldest issues summary
rules:
  - name: New issues
    conditions:
      state: opened
    limits:
      most_recent: 2
    actions:
      summarize:
        item: "- [ ] [{{title}}]({{web_url}}) {{labels}}"
        summary: |
          Please triage the following new {{type}}:
          {{items}}
actions:
  summarize:
    title: "Newest and oldest {{type}} summary"
    summary: |
      Please triage the following {{type}}:
      {{items}}
      Please take care of them before the end of #{7.days.from_now.strftime('%Y-%m-%d')}
      /label ~"needs attention"

Parameters:

  • resource_type (String)

    The resource type, e.g. issues or merge_requests.

  • summary_definition (Hash)

    A hash usually given as YAML in a triage policy file:

Returns:

  • (nil)


310
311
312
313
314
315
316
317
318
319
320
# File 'lib/gitlab/triage/engine.rb', line 310

def process_summary(resource_type, summary_definition)
  puts Gitlab::Triage::UI.header("Processing summary: **#{summary_definition[:name]}**", char: '~')
  puts

  summary_parts_for_rules(resource_type, summary_definition[:rules]) do |summary_resources|
    policy = Policies::SummaryPolicy.new(
      resource_type, summary_definition, summary_resources, network)

    process_action(policy)
  end
end