Skip to content

Alternate solutions if the GITHUB_ vars do not existΒ #34

@jeffalder

Description

@jeffalder

I know this is designed for a GitHub Actions environment, but I'm curious if we can modify the configuration slightly for other environments.

Today, this plugin will cause a build failure if it's applied without all its expected configuration. I've implemented this as a temporary workaround:

if (System.getenv("GITHUB_WORKSPACE") != null
        && System.getenv("GITHUB_REF") != null
        && System.getenv("GITHUB_SHA") != null
        && System.getenv("GITHUB_JOB") != null
        && System.getenv("GITHUB_RUN_NUMBER") != null) {
    apply plugin: GitHubDependencySubmissionPlugin
}

But this is fairly annoying to check, and it can get out-of-date. I'd like to propose 2 alternatives if the variables do not have values:

  1. Inject known placeholders, such as the name of the variable, into the JSON.
  2. Emit a warning message, don't apply anything, and therefore don't generate the JSON.

Note: I'm willing to PR this but I want to make sure I'm doing what the maintainers would accept.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions