Граф коммитов

311 Коммитов

Автор SHA1 Сообщение Дата
Simon Heather 22e3d7bdf6
GitHubRepositories: Add Get/Set/Remove GitHub Repository Team Permissions (#300)
Adds the following functions:

* `Get-GitHubRepositoryTeamPermission`
* `Set-GitHubRepositoryTeamPermission`
* `Remove-GitHubRepositoryTeamPermission`

References
* [Check team permissions for a repository](https://docs.github.com/en/free-pro-team@latest/rest/reference/teams#check-team-permissions-for-a-repository)
* [Add or update team repository permissions](https://docs.github.com/en/free-pro-team@latest/rest/reference/teams#add-or-update-team-repository-permissions)
* [Remove a repository from a team](https://docs.github.com/en/free-pro-team@latest/rest/reference/teams#remove-a-repository-from-a-team)

Resolves #307
2020-12-24 12:54:03 -08:00
Pepe Rivera 8fd4201020
Fix labels in events being treated as full label objects (#306)
`Get-GitHubEvent` is currently broken if the issue contains and event that includes the "label" or "labels" property. This is because `Add-GitHubEventAdditionalProperties` treats the labels in the event object as full fledged label objects that normally contain a URL property and other additional pieces of data. The label property in a `GitHub.Event` is a lighter-weight object that simply contains the string for the label and color that was changed, it is not the full object that you would typically receive from a call like `Get-GithubLabel`. 

Updated to add a new `GitHub.LabelSummary` type to describe this scenario, as well as passing in the needed `RepositoryUrl` when adding the additional label properties.
2020-12-21 16:42:51 -08:00
Simon Heather d4997057f8
GitHubRepositories: Add Get/Set GitHub Repository Actions Permissions (#301)
Adds the following functions to the `GitHubRepositories` module:

- `Get-GitHubRepositoryActionsPermission`
- `Set-GitHubRepositoryActionsPermission`

#### References

- [Get GitHub Actions permissions for a repository](https://docs.github.com/en/free-pro-team@latest/rest/reference/actions#get-github-actions-permissions-for-a-repository)
- [Set GitHub Actions permissions for a repository](https://docs.github.com/en/free-pro-team@latest/rest/reference/actions#set-github-actions-permissions-for-a-repository)
2020-12-06 08:25:44 -08:00
Jonathan Moss 8a29c7faa8
Fix markdown for example in USAGE.md (#299) 2020-11-02 19:31:57 -08:00
Howard Wolosky 28c4336825
Add reference to Wiki in USAGE.md (#298)
Add a reference to the documentation in the Wiki to the top of USAGE.md.
2020-10-27 15:08:09 -07:00
Ted Hudek 28e20d4a2a
Fix typo in example in USAGE.md (#297)
Changes an opening brace to parenthesis because `Add-GitHubIssueLabel` takes an array of label strings.
2020-10-23 12:10:37 -07:00
John ec7950c02c
Fixed the AuthorName/AuthorEmail variable check for Set-GitHubContent (#295)
Fixed the variable check for Set-GitHubContent.

Resolves #285.
2020-10-16 14:59:10 -07:00
Howard Wolosky c92d8a64eb
Fix potential call depth overflow error when retrying a 202 response (#294)
GitHub will return back a `202` response when the result for the query is not yet ready.  GitHub requests that we "give the job a few moments to complete, and then submit the request again."

We already had the configuration value `RetryDelaySeconds` which covered how many seconds we would sleep before trying the request again. We tried the request again via a recursive call to `Invoke-GHRestMethod`.

It turns out that there's something going on with GitHub right now, and trying to get contributor statistics for a completely new repository never returns back a 200, even after 145 retry attempts over 72 minutes.

That many recursive calls ends up causing a call depth overflow exception with PowerShell.  While this scenario should be an edge-case, nonetheless it seems better to remove the possibility of this error from occurring by modifying the retry logic to be a loop rather than a recursive call.

I've also added a new configuration value: `MaximumRetriesWhenResultNotReady` to help control and limit the number of retries that we'll attempt in this situation, ultimately throwing an exception if the retry limit is exceeded without a 200 response.

Finally, I've disabled the `When getting Github Repository Contributors with Statistics` test until the problem is fixed on the GitHub end.  I've disabled the test by commenting the test out vs using the disable keyword to avoid the Pester failure for disabled tests, and I've opened a [support issue](https://github.community/t/unable-to-retrieve-contributor-statistics-for-a-brand-new-repo/136658) on this problem.
2020-10-08 12:56:37 -07:00
Howard Wolosky c06614903e Fix static-analyzer warning for Windows PowerShell
The Build-* verb is new to PowerShell Core and so was considered
unapproved for Windows PowerShell.  Given that these are internal
helper methods and it _is_ an approved verb in PS Core, keeping as-is
and just marking these warning instances to be suppressed.
2020-10-07 14:22:16 -07:00
Howard Wolosky ab536c772a
Add missing .SYNOPSIS to functions (#293)
Now that we are generating help documentation for the module, we want to ensure that we have a .SYNOPSIS for every function CBH.
2020-10-05 00:25:32 -07:00
Howard Wolosky 4379a46572
Auto-generate documentation for Wiki (#292)
This adds a new script utility, `Build-Wiki.ps1`, which can be used to auto-generate the documentation for the Wiki.  This uses the [PlatyPS](https://github.com/PowerShell/PlatyPS) module to generate the actual help documentation.

Relevant notes:
* This will generate the `Home.md`, `_sidebar.md`, and `_footer.md`   files for the Wiki if they don't already exist in the destination directory.
* If they do already exist, it intelligently updates the content, only replacing the parts that it generated itself (denoted with
  comments in the markdown content itself).
* At present, this is not being hooked-up to CI because I don't want to deal with storing credentials that have admin access 
to the actual repo.

Tip of the hat to @X-Guardian for the suggestion and the initial help with writing this out.

Resolves #208
2020-10-04 23:07:59 -07:00
Jack Samuel S 35be16a9c4
Fix typos in USAGE.md (#288)
Fixes #287
2020-09-26 11:43:12 -07:00
Howard Wolosky 5b835cd543
Update module to 0.15.1 (#284) 2020-09-09 08:35:39 -07:00
Howard Wolosky e9a6810b3c
Fix default logPath when no user profile is available (#283)
In Azure Function Apps, the special `MyDocuments` folder resolves to an empty string, which means that the default `logPath` gets stored as an empty string.

3094c9789c/GitHubConfiguration.ps1 (L650-L657)

3094c9789c/GitHubConfiguration.ps1 (L671)

This causes problems when `Write-Log` is called by any other function, because we directly assign the current configuration value for `LogPath` as the parameter's default, which throws an exception when an empty string is assigned.

3094c9789c/Helpers.ps1 (L142)

In this scenario, we'll fall back to using the `LocalApplicationDataFolder` folder and writing a verbose message to the user letting them know this has happened.  I've opted for a verbose message as opposed to a warning to avoid a constant annoying warning for users.  The alternate path is documented in the updated USAGE.md, and it's also retrievable by calling `Get-GitHubConfiguration -Name LogPath`.

Documentation has also been updated to reflect this behavior change.

Fixes #282
2020-09-09 08:15:35 -07:00
Howard Wolosky 5ee03650b8 Increase max runtime for CI pipeline jobs 2020-09-08 21:43:11 -07:00
Howard Wolosky 3094c9789c Fixing README badges/links 2020-08-27 12:32:42 -07:00
Howard Wolosky 458d07c8f2 Update README's listing of current API support
Updated the summary of the current API support in the README to account
for the recent `0.15.0` changes.  Also added a direct link to the
CHANGELOG as well.
2020-08-20 12:54:04 -07:00
Howard Wolosky 200f4bd947 Fix README Table of Contents
`Logging` is in USAGE.md, not README.md
2020-08-20 12:36:51 -07:00
Howard Wolosky db5d33e7d8
Enhancing CHANGELOG for 0.15.0 (#279)
Added a number of additional details for the breaking changes being
introduced in order to make it easier for existing users to migrate
their code.

Some very minor changes have been additionally made to fix some
documentation or parameter typename issues.  Given that 0.15.0 still
hasn't been officially published yet, these changes will be part of
the eventual 0.15.0 release.
2020-08-17 20:08:36 -07:00
Howard Wolosky 515c1db36e
Updating module version to 0.15.0 (#278)
Updating the module version and and CHANGELOG in preparation for a release of v0.15.0
2020-08-16 16:26:33 -07:00
Howard Wolosky 9ef3c2b567
Improvements to GitHub Team API's (#275)
#257 did a fantastic job closing the gap on missing functionality in the module related to GitHub Teams.
This PR just adds onto that work by providing options that will reduce the need for additional queries during common operations.

* `Get-GitHubTeam`: **Breaking Change** Looking up a team by its `ID` has been deprecated per GitHub documentation.  Removed that functionality and added the ability to look up by `slug` instead.  This also means that you can now pipe in a team and get back the specific result without needing to filter through all org results.

* `Get-GitHubTeamMember`: Updated to use the `slug` instead of the team `ID`.

* `New-GitHubTeam`: Added ability to pass in the `ParentTeamId` (also via the pipeline) to avoid the need to query through all org teams.

* `Set-GitHubTeam`: Added ability to pass in the team `slug` (also via the pipeline) to avoid the need to query through all org teams.  Similar to `New-GitHubTeam`, also added the ability to pass-in the `ParentTeamId` to avoid the full org team lookup.

* `Remove-GitHubTeam`: Added ability to pass in the team `slug` (also via the pipeline) to avoid the need to query through all org teams.

* Added `Rename-GitHubTeam` as a helper/wrapper on top of `Set-GitHubTeam`

* Added additional pipeline tests for existing functions

* Added new tests for `Rename-GitHubTeam` and `Get-GitHubTeamMember`

* Small update to formatters to simplify the display of the team parent

References: [GitHub Teams API](https://developer.github.com/v3/teams/)
2020-08-14 16:41:20 -07:00
Howard Wolosky 9600fc2112
Updates all state-changing commands to be silent by default (with -PassThru) (#276)
All state-changing commands (with the exception of `New-*`) are now silent by default.  Users can pass-in `-PassThru` to make them return the result that used to be returned by default.

Users can revert back to the previous behavior by leveraging the new configuration value: `DefaultPassThru`.

Resolves #217
2020-08-14 12:35:53 -07:00
Howard Wolosky 3e79c2592c
Update New-GitHubBranch pipeline support (#277)
* Updates `New-GitHubBranch` to be able to take a `GitHub.Branch` object as pipeline input (for the base branch)
* Updates `New-GitHubBranch` to be able to take in a `Sha` so that a branch can be created from an arbitrary commit (which also enables a new branch to be created from a `GitHub.Branch` pipeline input value without needing to perform an additional query on `BranchName` to get its `Sha`)
* Updates `GitHub.Branch` to have `Sha` as a top-level property.
* Updated existing tests and added additional tests.

Reference: [GitHub Refs API](https://developer.github.com/v3/git/refs/)

Fixes #261
2020-08-13 00:11:44 -07:00
Howard Wolosky db111559f9
Removing NoStatus from the module (#274)
The `NoStatus` parameter (and `DefaultNoStatus` config value) were deprecated as part of #253 when we stopped showing status except for multi-page requests that exceeded some minimum number of pages.

At that time, `NoStatus` (and `DefaultNoStatus`) were not removed in order to minimize the churn to the module.  However, keeping it in is adding unnecessary complexity to the module as we continue to expand what the module can do.

This change removes `NoStatus` (and `DefaultNoStatus`) from the module entirely.  The only impact that this may cause is with users who are currently using one (or both) of them.  This breaking change impact should be minimal, but its best for the breaking change to be part of the coming release which already has a number of other breaking changes as well, as opposed to having more breaking changes in a successive release.
2020-08-11 20:03:33 -07:00
Simon Heather 6a51601ec8
GitHubTeams: Add New/Update/Remove Functions (#257)
Adds the following functions:

- `Add-GitHubTeam`
- `Update-GitHubTeam`
- `Remove-GitHubTeam`

It also adds the `TeamName` parameter to the `Get-GitHubTeam` function to allow getting team details by team name, which is used by the new functions.

Pester tests have also been added for the following functions:

- `Get-GitHubTeam`
- `Add-GitHubTeam`
- `Update-GitHubTeam`
- `Remove-GitHubTeam`

Positional Binding has been set as `false` for the three functions, and `Position` attributes added to the function's mandatory parameters.

Type view formats have been added for the `GitHub.TeamSummary` and `GitHub.Team` types.

API Reference: [GitHub Teams API](https://developer.github.com/v3/teams/)
2020-08-11 13:45:34 -07:00
Simon Heather 4ded2faf81
Fix GitHub Repository `Dependabot` Functions Pipeline Input (#272)
Fixes the pipeline input for the following GitHub Repository functions:
- `Disable-GitHubRepositoryVulnerabilityAlert`
- `Enable-GitHubRepositorySecurityFix`
- `Disable-GitHubRepositorySecurityFix`

The unit tests for the functions are also updated to add pipeline tests.

Fixes #270
2020-08-09 20:00:48 -07:00
Simon Heather 7de63abad0
Fix GitHubRepositorySecurityFix tests (#271)
This PR fixes the `Describe 'GitHubRepositories\Enable-GitHubRepositorySecurityFix'` and `Describe 'GitHubRepositories\Disable-GitHubRepositorySecurityFix'` GitHubRepositories tests following on from the change to the GitHub Automated Security Fixes API.

Reference: [Enable Automated Security Fixes](https://docs.github.com/en/rest/reference/repos#enable-automated-security-fixes)

Fixes #269
2020-08-09 09:18:11 -07:00
Simon Heather 2f16de1f46
PowerShellForGitHub: Improve and Standardise WhatIf/Confirm Processing (#254)
Improves and standardizes the WhatIf/Confirm ('ShouldProcess') processing across all the functions.

* Moved the `$PSCmdlet.ShouldProcess` check out of `Invoke-GHRestMethod` and added it to the calling functions with the correct operation and target.
* Added `WhatIf:$false` and `Confirm:$false` to the `Out-File` Cmdlet call in the `Write-Log` function in the Helpers module. This will prevent the `Write-Log` function displaying `WhatIf` and `Confirm` prompts.
* Removed `ShouldProcess` from non-state changing functions.
* Modified the current `ShouldProcess` conditions to use an early return.
* Modified the `Set-GitHubIssueLabel` function to remove `ConfirmImpact='High'` and set `ConfirmPreference` to 'Low' if no labels have been specified instead.
* Modified the `Update-GitHubRepository` function to remove `ConfirmImpact='High'` and set `ConfirmPreference` to 'Low' if the repo is being renamed instead.
2020-08-03 14:26:23 -07:00
Simon Heather 981b85c2d4
New GitHubRepositoryBranchProtectionRule Functions (#255)
Adds the following GitHub Branch Protection Rule functions:

- `Get-GitHubRepositoryBranchProtectionRule`
- `New-GitHubRepositoryBranchProtectionRule`
- `Remove-GitHubRepositoryBranchProtectionRule`

References:
- [Get Branch Protection](https://developer.github.com/v3/repos/branches/#get-branch-protection)
- [Update Branch Protection](https://developer.github.com/v3/repos/branches/#update-branch-protection)
- [Delete Branch Protection](https://developer.github.com/v3/repos/branches/#delete-branch-protection)
2020-07-31 15:42:25 -07:00
Howard Wolosky 437ac1b464 Add additional sleep to some tests to increase reliability 2020-07-22 08:28:28 -07:00
Howard Wolosky 92c4aa8b3a
Add support for gists (#172)
This completes the required work to support the full set of API's around gists.

It adds the following functions:
* `Get-GitHubGist`
* `Remove-GitHubGist`
* `Copy-GitHubGist` (aka. `Fork-GitHubGist`)
* `Add-GitHubGistStar`
* `Remove-GitHubGistStar`
* `Set-GitHubGistStar` (just a wrapper around `Add/Remove-GitHubGistStar`
* `Test-GitHubGistStar`
* `New-GitHubGist`
* `Set-GitHubGist`
   * `Rename-GitHubGistFile` (exposed helper function)
   * `Remove-GitHubGistFile` (exposed helper function)
   * `Set-GitHubGistFile` (exposed helper function, also known as `Add-GitHubGistFile`)
* `Get-GitHubGistComment`
* `Set-GitHubGistComment`
* `New-GitHubGistComment`
* `Remove-GitHubGistComment`

This also adds formatters for all newly introduced types: `GitHub.Gist`, `GitHub.GistCommit`, `GitHub.GistDetail`, and `GitHub.GistFork`.

Positional Binding has been set as `false`, and `Position` attributes added to the functions' mandatory parameters.

References:
[GitHub Gist](https://developer.github.com/v3/gists/)
[GitHub Gist Comments](https://developer.github.com/v3/gists/comments/)

Fixes #32
2020-07-20 15:07:58 -07:00
Howard Wolosky 356af2f5b6
Complete support for Releases API (#177)
This completes the required work to support the set of Releases API's.

It adds the following functions:

* `New-GitHubRelease`
* `Set-GitHubRelease`
* `Remove-GitHubRelease`
* `Get-GitHubReleaseAsset`
* `New-GitHubReleaseAsset`
* `Set-GitHubReleaseAsset`
* `Remove-GitHubReleaseAsset`

`Invoke-GHRestMethod` has been updated to be able to upload a file (via the new `InFile` parameter) and download a file (via the `Save` switch which will cause it to return back a `FileInfo` object of a temporary file which can then be renamed as seen fit by the caller).

This also adds formatters for `GitHub.Release` and `GitHub.ReleaseAsset`.

Positional Binding has been set as `false` for the three functions, and `Position` attributes added to the function's mandatory parameters.

Reference: [GitHub Releases](https://developer.github.com/v3/repos/releases/)


Fixes #47 
Fixes #110
2020-07-20 08:48:48 -07:00
Howard Wolosky 402529aa8d
Attempting to increase reliability of some Pester tests - take 2 (#268)
This is re-implementing #265 in a more robust way, thanks to a suggestion from @X-Guardian in #267.

Instead of adding in one-off sleeps throughout the test codebase, there is now a new configuration value `StateChangeDelaySeconds`) that will allow us to insert a delay before returning the result of _any_ state change request.

This should ideally consistently add reliability throughout the entire test codebase.
2020-07-19 11:35:40 -07:00
Howard Wolosky f406cc5b8a
Attempting to increase reliability of some Pester tests (#265)
We're seeing some inconsistent failures in some of the Pester tests.

The hypothesis is that GitHub may need a little bit more time after the creation of objects before performing certain operations on them (like renaming repos), or may need more time after deleting them before it will successfully return a 404 on a successive Get request.

I have added a number of `Start-Sleep`'s throughout the test codebase wherever we've encountered inconsistent failures, and that appears to have resolved the problem.  We may need to continue to do more of these if additional ones pop up.

The duration of the sleep itself is controlled by `$script:defaultSleepSecondsForReliability` which is defined in `Tests/Common.ps1`.

Long term, I have opened #267 which poses the idea of switching over to mocking out `Invoke-WebRequest` for the majority of the tests, and instead focus on validating the data that it's sending matches the expected values per the API documentation, and having just a limited number of tests that do actual end-to-end testing.

Fixes #264
2020-07-18 12:06:17 -07:00
Tyler James Leonhardt 8e55f5af03
Add GitHub Reactions support (#193)
Adds support for `Issue` and `PullRequest` reactions by adding the following new functions:

* [`Get-GitHubReaction`](https://developer.github.com/v3/reactions/#list-reactions-for-an-issue)
* [`Set-GitHubReaction`](https://developer.github.com/v3/reactions/#create-reaction-for-an-issue)
* [`Remove-GitHubReaction`](https://developer.github.com/v3/reactions/#delete-an-issue-reaction)
2020-07-16 11:45:59 -07:00
Simon Heather d76f54b08e
GitHubBranches: Add New/Remove-GitHubRepositoryBranch Functions (#256)
Adds the following functions to the `GitHubBranches` module:

* `New-GitHubRepositoryBranch`
* `Remove-GitHubRepositoryBranch`

#### References
[GitHub Refs API](https://developer.github.com/v3/git/refs/)
2020-07-16 11:42:21 -07:00
Howard Wolosky fcfe0c73b0
Formatter guidelines and CI job timeout extensions (#263)
* Add Formatter guidelines to CONTRIBUTING and the PR template
* Increase permitted time per-platform for CI validation from 60 -> 120 min
2020-07-15 09:47:46 -07:00
Howard Wolosky 683187a94f
Fix handling of numerical configuration properties across PS5 and PS7 (#262)
`ConvertFrom-Json` defaults numbers to different types depending on the PowerShell version.

PS5 defaults numbers to `[Int32]` while PS7 defaults numbers to `[Int64]`, but both versions default to `[Int32]` in a `[PSCustomObject]`.

Due to this, if you had a number config value saved, on PS7 it would be ignored and the default value would be used because the expected and actual types wouldn't match.

I've updated `Resolve-PropertyValue` to have equivalence logic for number types to avoid this issue.
2020-07-09 17:19:21 -07:00
Howard Wolosky 79e5ac2fcc
CI Build updates: build queuing and Windows PS7 (#260)
This updates the CI build with two new features:

1. **Validation against Windows PS7 (PowerShell Core)**
   This pipeline previously had three platforms that it tested against:
   * `Windows PS5`
   * `Linux PS7 (PowerShell Core)`
   * `macOS PS7 (PowerShell Core)`

   With this change, we add a fourth platform: `Windows PS7 (PowerShell Core)`

2. **Build queuing**
   The unit tests operate against live GitHub accounts (as opposed to mocking out the execution of the API calls).  Each platform has its own account that it operates against to alllow each platform to be tested in parallel.  However, if more than one build is queued at once, then the builds can start to stomp over the expected state in the tests accounts.  This change adds a new `job` to the pipeline which will create a "queue" of running builds by only allowing a build to continue processing once all previously queued builds have completed.

Initial idea came from here:
  https://developercommunity.visualstudio.com/idea/365730/prevent-parallel-execution-of-the-same-build-defin.html

- Fixes #239
2020-07-01 15:40:25 -07:00
Howard Wolosky 2740026e64
Reimagining status for the module (#253)
* Reimagining status for the module

Status for commands was originally added to this module based on my experience with other REST API's where individual commands could easily take 10-20 seconds.

Practical usage has shown that most GitHub requests in reality take under one second.  The additional work that PowerShell has to do in order to display progress to the user can easily make the overall command take 4-6 times longer than its actual execution time.

Therefore, status is being ripped out of this module (for the most part).  `Invoke-GHRestMethod` and `Invoke-SendTelemetryEvent` no longer have bifurcating execution paths based on the value of `$NoStatus`.  Everything runs synchronously now on the command prompt.

* `DefaultNoStatus` has been deprecated.  Its value will be ignored.
* The `NoStatus` switch has not been removed from the module commands in order to avoid a breaking change.  It may be removed in a future update.
* `Invoke-GHRestMethod -ExtendedResult` has been updated to include the next page's number and the total number of pages for the REST request.
* A new configuration value has been added: `MultiRequestProgressThreshold
  `Invoke-GHRestMethodMultipleResult` will display a ProgressBar to the user tracking the number of remaining requests for the overall execution of the requested command based on this threshold value.  It will only display the progress bar if the number of requets needed meets or exceeds this threshold value.  This defaults to 10, and can be disabled with a value of 0.  
  Practical usage has shown that this adds less than a second of additional time to the overall execution of a multi-request command (quite different than the previous status).
* `Wait-JobWithAnimation` has been removed since it's no longer used.

Fixes #247
2020-06-30 15:05:08 -07:00
Howard Wolosky f31d79133d
Fix pipeline support and testing for New-GitHubRepositoryFromTemplate (#259)
Added in #221, `New-GitHubRepositoryFromTemplate was not capturing the passed-in value for the RepositoryName if provided via a Uri parameter.

There was a pipeline test in place, however it missed this fact because it was only testing the pipeline input scenario using `-WhatIf`, and the error was only found when calling the actual REST API and GitHub noticed that the `RepositoryName` was missing from the URI.
2020-06-30 12:58:04 -07:00
Howard Wolosky 4287ac998b
Improve CI speed by changing repo targeted by Forks tests (#258)
Pull #251 changed the repo targeted by the forks tests from `microsoft/PowerShellForGitHub` to `octocat/Hello-World` in order to prevent the accidental deletion of real forks when running the UT's locally against your own account.

In practice, this almost doubled the execution time of the UT's, because the execution time of the Forks API's took so much longer against a repo with 1400+ forks.

Changing the test over to use a repo that currently only has 39 forks (several orders of magnitude fewer).
2020-06-29 16:33:07 -07:00
Howard Wolosky e57a9563ef
Standardize verb usage within the module (#228)
This attempts to rectify some improper verb usage in the module based on the explanations of intended verb usage from [previous PowerShell documentation](https://web.archive.org/web/20171222220053/https://msdn.microsoft.com/en-us/library/windows/desktop/ms714428(v=vs.85).aspx).

* We're standardizing on the following pattern for most object actions:
    `Get` / `Set` / `New` / `Remove`

* We will continue to alias `Remove-*` as `Delete-*`.

* When possible, this change attempts to avoid breaking changes by re-aliasing the newly named functions with their previous names. This was not possible in one instance, hence this is still a breaking change (although based on telemetry, it should be minimally impacting).

Result:
 * `Update-GitHubCurrentUser` -> `Set-GitHubProfile` `[Alias('Update-GitHubCurrentUser')]`
 * `Update-GitHubIssue` -> `Set-GitHubIssue`  `[Alias('Update-GitHubIssue')]`
 * `Update-GitHubRepository` -> `Set-GitHubRepository`  `[Alias('Update-GitHubRepository')]`
 * `New-GitHubAssignee` -> `Add-GitHubAssignee` `[Alias('New-GitHubAssignee')]`
 * [breaking] `Update-GitHubLabel` -> `Set-GitHubLabel`  `[Alias('Update-GitHubLabel')]`
 * [breaking] `Set-GitHubLabel` -> `Initialize-GitHubLabel` `<no alias due to above>`

Changing an existing label has much more regular usage than replacing all of the labels in a repository, hence allowing the _new_ `Set-GitHubLabel` to keep the alias of `Update-GitHubLabel`.

Our usage of the `Set-*` verb in general is a bit arguable based on the documentation ... in theory `Edit-*` might be a better fit since we're _editing_ aspects of an object as opposed to _replacing_ the entire content of an object.  However, I think `Set-*` _feels_ ok in this module.  We're _setting_ the state of these objects.  Again...arguable, but this is a much smaller breaking change to get to a consistent terminology state.
2020-06-28 22:35:12 -07:00
Howard Wolosky d32bd11d97
Invoke-UpdateCheck fixes (#252)
* Fixes a regression [introduced by #242 unfortunately](17f6122d78 (diff-34a614678760cc83c5a91ad95ae240e5R86)) when I was reducing the lines in the module that exceeded 100 chars.

Specifically (note the `=Message` instead of the `-Message`):
17f6122d78/UpdateCheck.ps1 (L86)

* Updates the web request to suppress the progress bar using `$ProgressPreference = 'SilentlyContinue'`

* Adds a `-Force` switch to force the update check to happen again to make future debugging scenarios easier.

Fixes #249
Fixes #250
2020-06-28 10:41:17 -07:00
Simon Heather eedfaa3740
Update GitHubRepositories Tests and Refactor Get-GitHubRepository Function (#233)
Updates the Pester tests for the `GitHubRepositories` module to increase the code coverage.

This also:
  * Refactors `Get-GithubRepository` to remove a code path that could never be taken
  * Adds a `ValidateSet` to the `Affiliation` parameter of the `Get-GitHubRepository` function
  * Fixes the Comment Based Help descriptions for the `Get-GitHubRepositoryCollaborator` and `Move-GitHubRepositoryOwnership`
2020-06-28 08:34:40 -07:00
Simon Heather 19c8417429
Update repo name in GitHubRepositoryForks tests (#251)
This PR updates the upstream Owner and Repo name used in the GitHubRepositoryForks tests to cause less destruction.
2020-06-28 08:31:10 -07:00
Simon Heather 41de3adb29
GitHubRepositories: Add Output Type Views (#205)
* Adds formatting for all of the types exposed in GitHubRepositories.ps1.
* Fixes the `OutputType` for RepositoryCollaborator and RepositoryContributor.
2020-06-27 16:23:00 -07:00
Simon Heather a1f5e93516
GitHubContents: New Function Set-GitHubContent (#241)
Adds `Set-GitHubContent`

An additional parameter `BranchName` has also been added to the `Get-GitHubContent` function which is required by `Set-GitHubContent`.

References: [GitHub Rest API v3 Contents](https://developer.github.com/v3/repos/contents/#create-or-update-file-contents)
2020-06-27 14:40:16 -07:00
Simon Heather d96541ee5e
GitHubRepositories: Add New-GitHubRepositoryFromTemplate Function (#221)
Adds a new function `New-GitHubRepositoryFromTemplate`.  This function creates a new GitHub repository from a specified template repository.

Fixes #220
2020-06-26 13:51:49 -07:00
Christoph Bergmeister [MVP] d855e80ae3
Add more logging into catch block when PSScriptAnalyzer encounters a fatal error (#246)
Enhancing #236
2020-06-26 09:01:34 -07:00