-
Notifications
You must be signed in to change notification settings - Fork 191
PowerShellForGitHub: Improve and Standardise WhatIf/Confirm Processing #248
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
Conversation
Ran the whole test suite for this PR, and the |
Oh no. I've immediately merged in #251 to avoid this in the future. So sorry about that. |
I've still got the branches locally, so no lost work, and I've pushed them back to my new fork of the repo, but the links to the open PRs are broken. PRs affected are:
Any idea how to fix the PRs? |
Not sure yet. Doing some searching online. Will be able to look a bit more this afternoon. |
I don't think you can. https://stackoverflow.com/questions/36071272/fix-unknown-repository-of-an-opened-pr-after-deleted-the-fork I think you'll just need to create new pull requests for those outstanding ones, and then close out the ones that have now been orphaned. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks good. Thanks for the effort.
A couple nits, and then a few that referenced the wrong value.
Actually, looking at this a bit more as full files as opposed to just the diffs, I think the one thing about the pattern that I'd change is that I'd move the check to the top of the functions as opposed to right before the call to |
If you are running a function with the |
Sufficiently compelling argument for me. Please keep as-is. |
This PR is superseded by PR #254 |
Description
This PR improves and standardises the WhatIf/Confirm ('ShouldProcess') processing across all the functions.
Summary of changes
$PSCmdlet.ShouldProcess
check out ofInvoke-GHRestMethod
and added it to the calling functions with the correct operation and target.Write-InvocationLog
line in each resource function to after the$PSCmdlet.ShouldProcess
condition block. This will prevent the log being updated ifShouldProcess
is$false
.WhatIf:$false
andConfirm:$false
to theOut-File
Cmdlet call in theWrite-Log
function in the Helpers module. This will prevent theWrite-Log
function displayingWhatIf
andConfirm
prompts.ShouldProcess
from non-state changing functions.ShouldProcess
conditions to use an early return.Set-GitHubIssueLabel
function to removeConfirmImpact='High'
and setConfirmPreference
to 'Low' if no labels have been specified instead.Update-GitHubRepository
function to removeConfirmImpact='High'
and setConfirmPreference
to 'Low' if the repo is being renamed instead.Issues Fixed
References
N/A
Checklist
Comment-based help added/updated, including examples.Changes to the manifest file follow the manifest guidance.Unit tests were added/updated and are all passing. See testing guidelines. This includes making sure that all pipeline input variations have been covered.Relevant usage examples have been added/updated in USAGE.md.If desired, ensure your name is added to our Contributors list