app/jobs/group_assignment_repo/create_github_repository_job.rb
# Creates a GroupAssignmentRepo and an associated GitHub repo.
# Starts a source import if starter code is specified.
#
# group_assignment - The assignment that will be used to create the GroupAssignmentRepo
# group            - The group that the GroupAssignmentRepo will belong to
# retries          - The number of times the job will automatically retry
#
# rubocop:disable MethodLength
# rubocop:disable AbcSize
Creates a GroupAssignmentRepo and an associated GitHub repo.
Starts a source import if starter code is specified.

The assignment that will be used to create the GroupAssignmentRepo
group            - The group that the GroupAssignmentRepo will belong to
retries          - The number of times the job will automatically retry


Creates a GroupAssignmentRepo and an associated GitHub repo . Starts a source import if starter code is specified . The assignment that will be used to create the GroupAssignmentRepo group - The group that the GroupAssignmentRepo will belong to retries - The number of times the job will automatically retry
def perform(group_assignment, group, retries: 0)
      start = Time.zone.now
      invite_status = group_assignment.invitation.status(group)
      return unless invite_status.waiting?
      invite_status.creating_repo!
      broadcast_message(CREATE_REPO, invite_status, group_assignment, group)
      GroupAssignmentRepo.create!(group_assignment: group_assignment, group: group)
      report_time(start)
      GitHubClassroom.statsd.increment("v2_group_exercise_repo.create.success")
      if group_assignment.starter_code?
        invite_status.importing_starter_code!
        broadcast_message(IMPORT_STARTER_CODE, invite_status, group_assignment, group)
        GitHubClassroom.statsd.increment("group_exercise_repo.import.started")
      else
        invite_status.completed!
        broadcast_message(CREATE_COMPLETE, invite_status, group_assignment, group)
      end
    rescue GitHub::Error, ActiveRecord::RecordInvalid => error
      handle_error(error, group_assignment, group, invite_status, retries)
    end
def perform ( group_assignment , group , retries : 0 ) start = Time . zone . now invite_status = group_assignment . invitation . status ( group ) return unless invite_status . waiting? invite_status . creating_repo! broadcast_message ( CREATE_REPO , invite_status , group_assignment , group ) GroupAssignmentRepo . create! ( group_assignment : group_assignment , group : group ) report_time ( start ) GitHubClassroom . statsd . increment ( "v2_group_exercise_repo.create.success" ) if group_assignment . starter_code? invite_status . importing_starter_code! broadcast_message ( IMPORT_STARTER_CODE , invite_status , group_assignment , group ) GitHubClassroom . statsd . increment ( "group_exercise_repo.import.started" ) else invite_status . completed! broadcast_message ( CREATE_COMPLETE , invite_status , group_assignment , group ) end rescue GitHub :: Error , ActiveRecord :: RecordInvalid => error handle_error ( error , group_assignment , group , invite_status , retries ) end
Creates a GroupAssignmentRepo and an associated GitHub repo.
Creates a GroupAssignmentRepo and an associated GitHub repo .
group_assignment
<not_specific>
group
<not_specific>
retries
<not_specific>