Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Publish_GitHub_Wiki_Content] Write-Build if $GitHubToken not specified #75

Closed
phbits opened this issue May 10, 2021 · 1 comment · Fixed by #77
Closed

[Publish_GitHub_Wiki_Content] Write-Build if $GitHubToken not specified #75

phbits opened this issue May 10, 2021 · 1 comment · Fixed by #77
Labels
enhancement The issue is an enhancement request. good first issue The issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub

Comments

@phbits
Copy link
Contributor

phbits commented May 10, 2021

When working with this module locally, significant time was spent to figure out why this task kept being skipped. The documentation for this task clearly states:

The task will only run if the variable $GitHubToken is set either in parent scope, as an environment variable, or if passed to the build task.
Source

However wouldn't it be more useful to output that status?

The current Publish_GitHub_Wiki_Content.build.ps1 is as follows:

task Publish_GitHub_Wiki_Content -if ($GitHubToken) {
...
}

What I'm proposing is something along the lines of:

task Publish_GitHub_Wiki_Content {

    if ($GitHubToken)
    {
        # do same stuff

    } else {

        Write-Build SomeColor '$GitHubToken not set via parent scope, as an environment variable, or passed to the build task.'
        Write-Build SomeColor 'Skipping task: Publish_GitHub_Wiki_Content'
}
@johlju
Copy link
Member

johlju commented May 17, 2021

By using -if ($GitHubToken) the command Invoke-Build evaluates if the task should be run and never actually starts the task, saving execution time. I would rather have seen that Invoke-Build supports an optional -SkipMessage instead. 🤔
But I can see the value in this so I can review a PR that adds this.

But I think it shuld just return directly

if ([System.String]::IsNullOrEmpty($GitHubToken))
{
     Write-Build SomeColor '$GitHubToken not set via parent scope, as an environment variable, or passed to the build task.'
     Write-Build SomeColor 'Skipping task: Publish_GitHub_Wiki_Content'

     return
}

@johlju johlju added enhancement The issue is an enhancement request. good first issue The issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub help wanted The issue is up for grabs for anyone in the community. labels May 17, 2021
@johlju johlju closed this as completed in #77 Jun 3, 2021
@johlju johlju removed the help wanted The issue is up for grabs for anyone in the community. label Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request. good first issue The issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub
Projects
None yet
2 participants