Class: Decidim::Backporter

Inherits:
Object
  • Object
show all
Defined in:
lib/decidim/backporter.rb

Defined Under Namespace

Classes: InvalidMetadataError

Instance Method Summary collapse

Constructor Details

#initialize(token:, pull_request_id:, version_number:, exit_with_unstaged_changes:) ⇒ Backporter

Returns a new instance of Backporter.

Parameters:

  • token (String)

    token for GitHub authentication

  • pull_request_id (String)

    the ID of the pull request that we want to backport

  • version_number (String)

    the version number of the release that we want to make the backport to

  • exit_with_unstaged_changes (Boolean)

    wheter we should exit cowardly if there is any unstaged change



11
12
13
14
15
16
# File 'lib/decidim/backporter.rb', line 11

def initialize(token:, pull_request_id:, version_number:, exit_with_unstaged_changes:)
  @token = token
  @pull_request_id = pull_request_id
  @version_number = version_number
  @exit_with_unstaged_changes = exit_with_unstaged_changes
end

Instance Method Details

#callvoid

This method returns an undefined value.

Handles the different tasks to create a backport:

  • Gets the metadata of a pull request on GitHub

  • Appls thi commit to another brach and push it to the remote repository

  • Creates the pull request on GitHub

Raises:



25
26
27
28
29
30
# File 'lib/decidim/backporter.rb', line 25

def call
   = 
  make_cherrypick_and_branch()
  create_pull_request()
  Decidim::GitBackportManager.checkout_develop
end