Getting type check errors for custom script!

I have developed a custom script and where in script 1 I’m trying to fetch some the users and in the 2nd part of the script assigning them new role for a series of projects.

Unfortunately I’m encountering the below error I tried fixing this different ways but no luck.
Need help on this part.

The script could not be compiled: ‹pre> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script20.groovy: The script could not be compiled:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script20.groovy: 103:

Unexpected input: “Process Completed!” @ line 103, column 31. log.info “Process Completed!” ^ 1 error

.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.project.ProjectManager
import com.atlassian.jira.project.Project
import com.atlassian.jira.security.roles.ProjectRole
import com.atlassian.jira.security.roles.ProjectRoleActors
import com.atlassian.jira.security.roles.ProjectRoleManager
import com.atlassian.jira.security.roles.ProjectRoleActor
import com.atlassian.jira.bc.projectroles.ProjectRoleService
import com.atlassian.jira.util.SimpleErrorCollection

// ------------------ Script 1: Identifying Users in a Project Role ------------------

// Function to identify users in the specified role across multiple projects
def identifyUsersInRole(String projectRoleName, List projectKeys) {
ProjectManager projectManager = ComponentAccessor.getProjectManager()
ProjectRoleManager projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager)

ProjectRole projectRole = projectRoleManager.getProjectRoles().find { it.name == projectRoleName }
if (!projectRole) {
    log.warn("Project role '${projectRoleName}' not found!")
    return []   // Early return on failure
}


List<String> userKeys = []   
String result = ""

projectKeys.each { String projectKey ->
    Project project = projectManager.getProjectObjByKey(projectKey)

    if (project) {  
        // Get role actors for this project
        ProjectRoleActors actors = projectRoleManager.getProjectRoleActors(projectRole, project)

      
        def usersInRole = actors.getUsers()*.key
        userKeys.addAll(usersInRole)  

       
        result += "$project.key, $project.name, $project.projectLead.displayName, ${usersInRole}\n"
    } else {
        log.warn("Project not found for key: $projectKey")
    }
}

// --- Debugging: Log results ---
log.info("Users identified: $userKeys")
log.info("Result: $result")

return userKeys   

}

// ------------------ Script 2: Assigning Users to Another Role ------------------

// Function to assign identified users to the target role across multiple projects
def assignUsersToRole(List userKeys, String targetRoleName, List projectKeys) {
ProjectRoleManager projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager)
ProjectManager projectManager = ComponentAccessor.getProjectManager()
ProjectRoleService projectRoleService = ComponentAccessor.getComponent(ProjectRoleService)
def errorCollection = new SimpleErrorCollection()

// --- Validate: Make sure target role exists ---
ProjectRole targetProjectRole = projectRoleManager.getProjectRoles().find { it.name == targetRoleName }
if (!targetProjectRole) {
    log.warn("Target project role '${targetRoleName}' not found!")
    return   // Early return if the target role is not found
}


if (!userKeys) {
    log.warn("No users found to assign to '$targetRoleName' role.")
    return   // Early return if there are no users to assign
}


projectKeys.each { String projectKey ->
    Project project = projectManager.getProjectObjByKey(projectKey)

    if (project) {
     
        projectRoleService.addActorsToProjectRole(
            userKeys, targetProjectRole, project,
            ProjectRoleActor.USER_ROLE_ACTOR_TYPE, errorCollection
        )


        if (errorCollection.hasAnyErrors()) {
            log.warn("Errors assigning users to the '$targetRoleName' role in project $projectKey: ${errorCollection.errors}")
        } else {
            log.info("Successfully assigned users to the '$targetRoleName' role in project $projectKey")
        }
    } else {
        log.warn("Project not found for projectKey $projectKey")
    }
}

}

// ------------------ Main Logic: Combine Both Functions ------------------

// Define the role and project keys
final String sourceRoleName = “ABC”
final String targetRoleName = “DEF”
final List projectKeys = [‘Project1’, ‘Project2’]

// — Step 1: Identify users in the source role —
List identifiedUsers = identifyUsersInRole(sourceRoleName, projectKeys)

// — Step 2: Assign identified users to the target role —
assignUsersToRole(identifiedUsers, targetRoleName, projectKeys)

// — Final logging and return —
log.info(“Process completed!”)
return “Process completed!”