All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.exasol.projectkeeper.github.OutputPublisherFactory Maven / Gradle / Ivy

The newest version!
package com.exasol.projectkeeper.github;

import java.nio.file.Path;
import java.util.Map;
import java.util.Optional;

/**
 * This factory creates new {@link WorkflowOutput}. If environment variable {@code GITHUB_OUTPUT} is present, the
 * created publisher will append to the referenced file. If the environment variable is not present, the publisher won't
 * publish anything.
 */
class OutputPublisherFactory {
    private final Map environment;

    OutputPublisherFactory(final Map environment) {
        this.environment = environment;
    }

    WorkflowOutput create() {
        return Optional.ofNullable(environment.get("GITHUB_OUTPUT")) //
                .map(Path::of) //
                .map(FileContentProvider::create) //
                .orElseGet(NullContentProvider::new);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy