function init() {
    return __awaiter(this, void 0, void 0, function* () {
        try {
            if (util_1.isNullOrUndefined(constants_1.action.accessToken) &&
                util_1.isNullOrUndefined(constants_1.action.gitHubToken)) {
                return core.setFailed("You must provide the action with either a Personal Access Token or the GitHub Token secret in order to deploy.");
            }
            if (constants_1.action.build.startsWith("/") || constants_1.action.build.startsWith("./")) {
                return core.setFailed(`The deployment folder cannot be prefixed with '/' or './'. Instead reference the folder name directly.`);
            }
            yield execute_1.execute(`git init`, constants_1.workspace);
            yield execute_1.execute(`git config user.name ${constants_1.action.name}`, constants_1.workspace);
            yield execute_1.execute(`git config user.email ${constants_1.action.email}`, constants_1.workspace);
            yield execute_1.execute(`git remote rm origin`, constants_1.workspace);
            yield execute_1.execute(`git remote add origin ${constants_1.repositoryPath}`, constants_1.workspace);
            yield execute_1.execute(`git fetch`, constants_1.workspace);
        }
        catch (error) {
            core.setFailed(`There was an error initializing the repository: ${error}`);
        }
        finally {
            return Promise.resolve("Initialization step complete...");
        }
    });
}
/** Generates the branch if it doesn't exist on the remote.
 * @returns {Promise}
 */
Generates the branch if it doesn't exist on the remote.
@returns {Promise}
Generates the branch if it doesn ' t exist on the remote . @returns { Promise }
function init() {
    return __awaiter(this, void 0, void 0, function* () {
        try {
            if (util_1.isNullOrUndefined(constants_1.action.accessToken) &&
                util_1.isNullOrUndefined(constants_1.action.gitHubToken)) {
                return core.setFailed("You must provide the action with either a Personal Access Token or the GitHub Token secret in order to deploy.");
            }
            if (constants_1.action.build.startsWith("/") || constants_1.action.build.startsWith("./")) {
                return core.setFailed(`The deployment folder cannot be prefixed with '/' or './'. Instead reference the folder name directly.`);
            }
            yield execute_1.execute(`git init`, constants_1.workspace);
            yield execute_1.execute(`git config user.name ${constants_1.action.name}`, constants_1.workspace);
            yield execute_1.execute(`git config user.email ${constants_1.action.email}`, constants_1.workspace);
            yield execute_1.execute(`git remote rm origin`, constants_1.workspace);
            yield execute_1.execute(`git remote add origin ${constants_1.repositoryPath}`, constants_1.workspace);
            yield execute_1.execute(`git fetch`, constants_1.workspace);
        }
        catch (error) {
            core.setFailed(`There was an error initializing the repository: ${error}`);
        }
        finally {
            return Promise.resolve("Initialization step complete...");
        }
    });
}
function init ( ) { return __awaiter ( this , void 0 , void 0 , function * ( ) { try { if ( util_1 . isNullOrUndefined ( constants_1 . action . accessToken ) && util_1 . isNullOrUndefined ( constants_1 . action . gitHubToken ) ) { return core . setFailed ( "You must provide the action with either a Personal Access Token or the GitHub Token secret in order to deploy." ) ; } if ( constants_1 . action . build . startsWith ( "/" ) || constants_1 . action . build . startsWith ( "./" ) ) { return core . setFailed ( ` ` ) ; } yield execute_1 . execute ( ` ` , constants_1 . workspace ) ; yield execute_1 . execute ( ` ${ constants_1 . action . name } ` , constants_1 . workspace ) ; yield execute_1 . execute ( ` ${ constants_1 . action . email } ` , constants_1 . workspace ) ; yield execute_1 . execute ( ` ` , constants_1 . workspace ) ; yield execute_1 . execute ( ` ${ constants_1 . repositoryPath } ` , constants_1 . workspace ) ; yield execute_1 . execute ( ` ` , constants_1 . workspace ) ; } catch ( error ) { core . setFailed ( ` ${ error } ` ) ; } finally { return Promise . resolve ( "Initialization step complete..." ) ; } } ) ; }
Generates the branch if it doesn't exist on the remote.
Generates the branch if it doesn ' t exist on the remote .