Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
197 commits
Select commit Hold shift + click to select a range
b9c6fcb
Add GetRepo functions
MariusStorhaug Oct 8, 2023
52dfb61
Fix for repoByOrg
MariusStorhaug Oct 8, 2023
1672151
Add a unified Get-Repo function
MariusStorhaug Oct 8, 2023
efc599f
Fix for GetGitHubRepos
MariusStorhaug Oct 8, 2023
ea41c8f
Fix streaming output for GitHubRepoListById
MariusStorhaug Oct 8, 2023
4e27962
Fix some issues + streaming
MariusStorhaug Oct 8, 2023
310d096
Move verbose API output to API function
MariusStorhaug Oct 8, 2023
9332806
Fix API call
MariusStorhaug Oct 8, 2023
d4a4c59
Fix Get-MyRepos
MariusStorhaug Oct 8, 2023
e345c56
Fix parameterset type
MariusStorhaug Oct 8, 2023
4e98ee2
Fixed dynamic param for type
MariusStorhaug Oct 8, 2023
ab9f125
Integration to Get-GitHubRepository
MariusStorhaug Oct 8, 2023
04dfe85
Add logging
MariusStorhaug Oct 8, 2023
5282534
Reorg and fix Get-GitHubRepository
MariusStorhaug Oct 8, 2023
0ab5cac
remove stale samples
MariusStorhaug Oct 8, 2023
d73b955
Add command to create org repo
MariusStorhaug Oct 8, 2023
2b63141
Added verbosity for logging
MariusStorhaug Oct 8, 2023
e739cef
added remove repo function
MariusStorhaug Oct 8, 2023
1b3da5c
Add a try catch on invoke
MariusStorhaug Oct 8, 2023
d315490
Add more param handling on new repo
MariusStorhaug Oct 8, 2023
1e453bf
Add testing stuff
MariusStorhaug Oct 8, 2023
2b0a903
Add helpers for dynamic param
MariusStorhaug Oct 8, 2023
87dc378
Added GitIgnore function
MariusStorhaug Oct 8, 2023
db6a5d0
Added dynamic param functions
MariusStorhaug Oct 8, 2023
1b0b26e
Added license
MariusStorhaug Oct 9, 2023
56dd59f
fix dynamic param for gitignore
MariusStorhaug Oct 9, 2023
27bafed
Fix dynamic param for repo
MariusStorhaug Oct 9, 2023
c3d487d
Align dynamic param for get repo
MariusStorhaug Oct 9, 2023
f6164d3
Fix dynamicParam new repo
MariusStorhaug Oct 9, 2023
d5926c6
fix params for licensing
MariusStorhaug Oct 9, 2023
00c00cf
Add function to create new personal repo
MariusStorhaug Oct 9, 2023
156e3c6
Align PerPage
MariusStorhaug Oct 9, 2023
4b2634d
Add function to set and get topics
MariusStorhaug Oct 9, 2023
61fa38b
Fix topic commands
MariusStorhaug Oct 9, 2023
55e7476
Added Get-contributors
MariusStorhaug Oct 9, 2023
fd49a9f
Added Get-repoteams
MariusStorhaug Oct 9, 2023
ac30a81
Added get repotags
MariusStorhaug Oct 9, 2023
1ec6f35
Add Get-Secfixes
MariusStorhaug Oct 12, 2023
220f8dc
Add Move-Repo
MariusStorhaug Oct 12, 2023
46e7bd6
Added Security fix enable disable function
MariusStorhaug Oct 12, 2023
23dd302
Added Get-RepoActivity
MariusStorhaug Oct 12, 2023
6564da8
Added get repo CODEOWNERS errors
MariusStorhaug Oct 12, 2023
296c74a
Test new version of pipeline
MariusStorhaug Oct 14, 2023
a60ef8c
Merge branch 'main' of https://github.com/PSModule/GitHub into 62-fea…
MariusStorhaug Oct 22, 2023
8b41253
Added vscode files
MariusStorhaug Oct 22, 2023
b779392
Merge branch 'main' of https://github.com/PSModule/GitHub into 62-fea…
MariusStorhaug Oct 23, 2023
297a09f
Fix output type
MariusStorhaug Oct 23, 2023
47bfd01
Fix docs for Get-GitHubRepoBranch
MariusStorhaug Oct 24, 2023
147405a
Merge branch '62-feature-repositories-repositories-manage-repositorie…
MariusStorhaug Oct 24, 2023
2ffbec3
fix docs for Remove-GitHubWorkflowRun
MariusStorhaug Oct 24, 2023
3400075
Clean docs for Remove-HashtableEntries
MariusStorhaug Oct 24, 2023
cd1844f
fix
MariusStorhaug Oct 24, 2023
3b86b99
removed menu as its currently not used
MariusStorhaug Oct 26, 2023
5f2815d
Fix DynamicParam
MariusStorhaug Oct 26, 2023
2284336
Fix for dynamicParam
MariusStorhaug Oct 26, 2023
9ee130e
remove deployments
MariusStorhaug Oct 26, 2023
84ab255
exempt the all switch
MariusStorhaug Oct 26, 2023
610a819
fix URL of unblock user from organization
MariusStorhaug Oct 26, 2023
30cf03d
Fixes
MariusStorhaug Oct 26, 2023
acd6b2f
fix issue
MariusStorhaug Oct 26, 2023
bf8ca06
fix Get-GitHubWorkflow
MariusStorhaug Oct 26, 2023
64b8b84
2fix $RunID
MariusStorhaug Oct 26, 2023
c234572
fix
MariusStorhaug Oct 26, 2023
0790b4e
fix PSReviewUnusedParameter
MariusStorhaug Oct 26, 2023
b32ce73
cleanup
MariusStorhaug Oct 26, 2023
7dc9efb
fixes
MariusStorhaug Oct 26, 2023
056948b
fix issues
MariusStorhaug Oct 26, 2023
747c50c
fix
MariusStorhaug Oct 27, 2023
9c2b4e1
Fix shouldprocess
MariusStorhaug Oct 27, 2023
107c7b5
fix should process
MariusStorhaug Oct 27, 2023
95e23f6
Fix
MariusStorhaug Oct 27, 2023
e5515a5
fix should process
MariusStorhaug Oct 27, 2023
40fb591
Fix should process
MariusStorhaug Oct 27, 2023
e504423
fixed param doc and should process
MariusStorhaug Oct 27, 2023
2faf1ff
fix should process
MariusStorhaug Oct 27, 2023
39ecaae
fix should process
MariusStorhaug Oct 27, 2023
c42c058
Fix params and shouldprocess
MariusStorhaug Oct 27, 2023
32f12ee
fix should process and example
MariusStorhaug Oct 27, 2023
40deb4a
Fix ShouldProcess
MariusStorhaug Oct 27, 2023
e9b67d1
Fix should proc
MariusStorhaug Oct 27, 2023
8c68f81
fix
MariusStorhaug Oct 27, 2023
910c3a8
fix
MariusStorhaug Oct 27, 2023
2d300ea
Fix
MariusStorhaug Oct 27, 2023
9fcb397
fix
MariusStorhaug Oct 27, 2023
3d788a4
Fix
MariusStorhaug Oct 27, 2023
5b02d00
fix hsouldp rocess
MariusStorhaug Oct 27, 2023
ec757c0
Fix
MariusStorhaug Oct 27, 2023
9aac440
fix
MariusStorhaug Oct 27, 2023
8de209b
Fix
MariusStorhaug Oct 27, 2023
c61e453
plurals
MariusStorhaug Oct 27, 2023
82e3613
rename
MariusStorhaug Oct 27, 2023
6997591
fix plurals
MariusStorhaug Oct 27, 2023
dd9eddd
fix
MariusStorhaug Oct 27, 2023
224228a
fix New-GitHubReleaseNotes
MariusStorhaug Oct 27, 2023
8d73c9e
fix plural
MariusStorhaug Oct 27, 2023
5cc7752
Fix
MariusStorhaug Oct 27, 2023
9a68f8c
fix Get-GitHubRepositoryTeam
MariusStorhaug Oct 27, 2023
0f7bde3
fix for Disable-GitHubRepositorySecurityFixes
MariusStorhaug Oct 27, 2023
625ba78
Fix
MariusStorhaug Oct 27, 2023
c4fa799
fix
MariusStorhaug Oct 27, 2023
6d27eb1
fix
MariusStorhaug Oct 27, 2023
19d09ad
Fix
MariusStorhaug Oct 27, 2023
1a1196f
Fix
MariusStorhaug Oct 27, 2023
01d320b
fixes
MariusStorhaug Oct 27, 2023
c66bfd1
fix
MariusStorhaug Oct 27, 2023
7d65fe7
Disable writehost warning
MariusStorhaug Oct 27, 2023
688cf8c
fix
MariusStorhaug Oct 27, 2023
9dd93ad
Fixa issues
MariusStorhaug Oct 27, 2023
6a6a8c2
fix
MariusStorhaug Oct 27, 2023
846b9f9
fix
MariusStorhaug Oct 28, 2023
a6bcd01
Long line fixes
MariusStorhaug Oct 28, 2023
49475db
fix long lines
MariusStorhaug Oct 29, 2023
b6f2fa8
Fix
MariusStorhaug Oct 29, 2023
b3c573b
Fix for PWSH 7.0
MariusStorhaug Oct 29, 2023
a9648ae
ws fix
MariusStorhaug Oct 29, 2023
d3f51a4
Fix
MariusStorhaug Oct 29, 2023
ae88213
fix alias Test-GitHubBlockedUser
MariusStorhaug Oct 29, 2023
4beffee
Fix Unblock-GitHubUser
MariusStorhaug Oct 29, 2023
5efd451
Fix
MariusStorhaug Oct 29, 2023
c3b1946
Attempt to fix longline
MariusStorhaug Oct 29, 2023
27ec0fe
fix
MariusStorhaug Oct 29, 2023
493240e
Add an attributes file for the module
MariusStorhaug Oct 29, 2023
6c2eef8
Remove the continue for errors on tests
MariusStorhaug Oct 29, 2023
7134cfc
Fix pipeline streaming
MariusStorhaug Oct 29, 2023
e326e08
fix indentation
MariusStorhaug Oct 29, 2023
1a69d1b
Add Enable-GitHubRepositoryVulnerabilityAlert
MariusStorhaug Oct 30, 2023
ef93292
Fix + add Disable VulnAlert
MariusStorhaug Oct 30, 2023
75c3040
test rules
MariusStorhaug Oct 30, 2023
fad1949
Fix longline
MariusStorhaug Oct 30, 2023
679e926
Fix + Add Get-repo lang
MariusStorhaug Oct 30, 2023
1fc123e
Adding vulnerabilityreporting coms
MariusStorhaug Oct 30, 2023
9e7a3c7
Add Test-RepoVulnerabiltyAlerts
MariusStorhaug Oct 30, 2023
e222812
Added a remaining file
MariusStorhaug Oct 31, 2023
ef12cbe
Create a NewRepoWrapper function
MariusStorhaug Oct 31, 2023
5dee51e
Fix example function name
MariusStorhaug Oct 31, 2023
982712f
Fix shoudprocess
MariusStorhaug Oct 31, 2023
0f7f6fa
Test removing suppression
MariusStorhaug Oct 31, 2023
6453057
Move new-repo org and user to private
MariusStorhaug Oct 31, 2023
dfa5a4d
Add new repo from template
MariusStorhaug Oct 31, 2023
b834ad5
Added Update repo
MariusStorhaug Nov 2, 2023
0038b64
Update remaining items
MariusStorhaug Nov 2, 2023
35c40d3
Test adding tests
MariusStorhaug Nov 3, 2023
efb06ac
Merge branch '62-feature-repositories-repositories-manage-repositorie…
MariusStorhaug Nov 3, 2023
9e12882
Add test for GitHubStatus
MariusStorhaug Nov 5, 2023
31becaf
Added tests for Status
MariusStorhaug Nov 5, 2023
b88ff7b
Added tests for ratelimit
MariusStorhaug Nov 5, 2023
46b8ff2
test
MariusStorhaug Nov 5, 2023
a672d09
Fix get ghconfig
MariusStorhaug Nov 5, 2023
5a2751b
fix
MariusStorhaug Nov 5, 2023
dcd6213
Added Auth tests
MariusStorhaug Nov 5, 2023
5102787
test
MariusStorhaug Nov 5, 2023
06bc914
Add the gh token
MariusStorhaug Nov 5, 2023
3405eee
GH token rename
MariusStorhaug Nov 5, 2023
b5555c0
write verbose
MariusStorhaug Nov 5, 2023
7d06a83
Show envvars
MariusStorhaug Nov 5, 2023
74ea528
outstring
MariusStorhaug Nov 5, 2023
016afd8
try with GH tokens
MariusStorhaug Nov 5, 2023
492ea19
Test
MariusStorhaug Nov 5, 2023
068aada
test
MariusStorhaug Nov 5, 2023
9263e71
test
MariusStorhaug Nov 5, 2023
c96a2a5
test error output change
MariusStorhaug Nov 5, 2023
f1c1f91
fix verbose
MariusStorhaug Nov 5, 2023
53ffbdb
test
MariusStorhaug Nov 5, 2023
1d04925
Allow null on convertFrom-Hashtable
MariusStorhaug Nov 5, 2023
b4f23aa
Format fix
MariusStorhaug Nov 5, 2023
f04770b
Remove stream
MariusStorhaug Nov 5, 2023
6c86ef7
Test
MariusStorhaug Nov 5, 2023
f5c16c2
Fix
MariusStorhaug Nov 5, 2023
e159afb
test
MariusStorhaug Nov 5, 2023
4439e38
test
MariusStorhaug Nov 5, 2023
4ba1123
Adding option for httpversion if psversion is -ge 7.3
MariusStorhaug Nov 5, 2023
289f79b
test
MariusStorhaug Nov 5, 2023
1ddf647
fix
MariusStorhaug Nov 5, 2023
e676b81
Fixes
MariusStorhaug Nov 5, 2023
3c67d74
Remove some tests
MariusStorhaug Nov 5, 2023
5190300
Start repo event
MariusStorhaug Nov 5, 2023
faf446c
Create repo as fork
MariusStorhaug Nov 5, 2023
bc32cb7
Get forks
MariusStorhaug Nov 5, 2023
9661fb6
Set params for fork
MariusStorhaug Nov 5, 2023
7cd82c5
fix param mandatory
MariusStorhaug Nov 5, 2023
eb366fb
fix fork
MariusStorhaug Nov 5, 2023
a236000
fix mandatory param
MariusStorhaug Nov 5, 2023
b52bdf2
fix
MariusStorhaug Nov 5, 2023
7959e10
Fix null or empty
MariusStorhaug Nov 5, 2023
1b7f71e
Default forked repo name to the upstream name
MariusStorhaug Nov 5, 2023
322c778
flip switch to bool
MariusStorhaug Nov 5, 2023
f777ec3
fix
MariusStorhaug Nov 5, 2023
2c2cd87
fix
MariusStorhaug Nov 5, 2023
e104352
fix fork params
MariusStorhaug Nov 5, 2023
1daf865
Fix name if not provided
MariusStorhaug Nov 6, 2023
945417d
troubleshooting
MariusStorhaug Nov 6, 2023
d6703ae
fixes
MariusStorhaug Nov 6, 2023
9fa68b5
Add functions for autolinks
MariusStorhaug Nov 6, 2023
175c0a4
Add a wrapper for Get-GitHubRepositoryAutolink
MariusStorhaug Nov 6, 2023
c164043
Update param set
MariusStorhaug Nov 6, 2023
0fc6581
Added an example for get-autolink
MariusStorhaug Nov 6, 2023
7937a65
Adds function for get repo custom props
MariusStorhaug Nov 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
- package-ecosystem: 'github-actions' # See documentation for possible values
directory: '/' # Location of package manifests
schedule:
interval: "weekly"
- package-ecosystem: "nuget" # See documentation for possible values
directory: "/" # Location of package manifests
interval: 'weekly'
- package-ecosystem: 'nuget' # See documentation for possible values
directory: '/' # Location of package manifests
schedule:
interval: "weekly"
interval: 'weekly'
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
"editor.insertSpaces": true,
"editor.tabSize": 2
},
"editor.rulers": [
0,
150
],
"powershell.codeFormatting.autoCorrectAliases": true,
"powershell.codeFormatting.newLineAfterCloseBrace": false,
"powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationForFirstPipeline",
Expand Down
22 changes: 11 additions & 11 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
- Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities
Expand Down Expand Up @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ Press Enter to open github.com in your browser...:
```

#### Personal access token

This is the least secure method of authentication, but it is also the simplest. Running the `Connect-GitHubAccount` command
with the `-AccessToken` parameter will send you to the GitHub website where you can create a new personal access token.
Give it the access you need and paste it into the terminal.
Expand All @@ -100,6 +101,7 @@ Connect-GitHubAccount -AccessToken
```

#### System Access Token

The module also detects the presence of a system access token and uses that if it is present.
This is useful if you are running the module in a CI/CD pipeline or in a scheduled task.
The function looks for the `GH_TOKEN` and `GITHUB_TOKEN` environment variables (in order).
Expand All @@ -110,6 +112,7 @@ Connect-GitHubAccount
```

### Command Exploration

Familiarize yourself with the available cmdlets using the module's comprehensive documentation or inline help.

```powershell
Expand Down Expand Up @@ -144,25 +147,31 @@ For a detailed understanding of the framework, [read more about PSModule here](h
## References

### Official GitHub Resources:

- [REST API Description](https://github.com/github/rest-api-description)
- [GitHub CLI Manual](https://cli.github.com/manual/)
- [GitHub Platform Samples](https://github.com/github/platform-samples)

### General Web References:

- [Generic HTTP Status Codes (MDN)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status)

### Tools Planned for Development:

- [Azure AutoRest (OpenAPI Specification Code Generator)](https://github.com/Azure/autorest)

### Inspiration Behind the Project:

- [Microsoft's PowerShellForGitHub](https://github.com/microsoft/PowerShellForGitHub)
- [PSGitHub by pcgeek86](https://github.com/pcgeek86/PSGitHub)
- [PSSodium by TylerLeonhardt](https://github.com/TylerLeonhardt/PSSodium)
- [libsodium NuGet Package](https://www.nuget.org/packages/Sodium.Core/)

### Authentication and Login:

- [PowerShell for GitHub on GitHub Marketplace](https://github.com/apps/powershell-for-github)
- [Building a CLI with a GitHub App](https://docs.github.com/en/apps/creating-github-apps/writing-code-for-a-github-app/building-a-cli-with-a-github-app)

### Module Configuration and Environment:

- [GH Environment for GitHub CLI](https://cli.github.com/manual/gh_help_environment)
8 changes: 3 additions & 5 deletions src/GitHub/GitHub.psd1
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
@{
# Author of this module
Author = 'Marius Storhaug'

# Version number of this module
ModuleVersion = '0.3.0'

# Description of the functionality provided by this module
Description = 'GitHub PowerShell Module'

# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{
# Private data to pass to the module specified in RootModule/ModuleToProcess.
# This may also contain a PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{

PSData = @{

Expand Down
1 change: 1 addition & 0 deletions src/GitHub/attributes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains long links.')]
4 changes: 2 additions & 2 deletions src/GitHub/data/Auth.psd1
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@{
GitHubApp = @{
GitHubApp = @{
ClientID = 'Iv1.f26b61bc99e69405' # $script:Auth.GitHubApp.ClientID
}
OAuthApp = @{
OAuthApp = @{
ClientID = '7204ae9b0580f2cb8288' # $script:Auth.OAuthApp.ClientID
}
AccessTokenGracePeriodInHours = 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
https://docs.github.com/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps#device-flow
#>
[OutputType([void])]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '', Justification = 'Is the CLI part of the module.')]
[CmdletBinding()]
param(
# The Client ID of the GitHub App.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@

This will test if the GitHub access token should be refreshed.
#>
[OutputType([bool])]
[CmdletBinding()]
param()

$tokenType = Get-GitHubConfig -Name 'AccessTokenType' -ErrorAction SilentlyContinue
if ($tokenType -ne 'ghu_*') {
Write-Verbose "The access token is not a user token. No need to refresh."
Write-Verbose 'The access token is not a user token. No need to refresh.'
return $false
}

Expand Down
20 changes: 10 additions & 10 deletions src/GitHub/private/Config/Initialize-SecretVault.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@

function Initialize-SecretVault {
<#
.SYNOPSIS
Initialize a secret vault.
.SYNOPSIS
Initialize a secret vault.

.DESCRIPTION
Initialize a secret vault. If the vault does not exist, it will be created.
.DESCRIPTION
Initialize a secret vault. If the vault does not exist, it will be created.

.EXAMPLE
Initialize-SecretVault -Name 'SecretStore' -Type 'Microsoft.PowerShell.SecretStore'
.EXAMPLE
Initialize-SecretVault -Name 'SecretStore' -Type 'Microsoft.PowerShell.SecretStore'

Initializes a secret vault named 'SecretStore' using the 'Microsoft.PowerShell.SecretStore' module.
Initializes a secret vault named 'SecretStore' using the 'Microsoft.PowerShell.SecretStore' module.

.NOTES
For more information about secret vaults, see https://learn.microsoft.com/en-us/powershell/utility-modules/secretmanagement/overview?view=ps-modules
.NOTES
For more information about secret vaults, see
https://learn.microsoft.com/en-us/powershell/utility-modules/secretmanagement/overview?view=ps-modules
#>

[OutputType([void])]
[CmdletBinding()]
param (
Expand Down
6 changes: 4 additions & 2 deletions src/GitHub/private/Config/Reset-GitHubConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#>
[Alias('Reset-GHConfig')]
[OutputType([void])]
[CmdletBinding()]
[CmdletBinding(SupportsShouldProcess)]
param(
# Reset the GitHub configuration for a specific scope.
[Parameter()]
Expand Down Expand Up @@ -58,5 +58,7 @@
}
}
}
Set-GitHubConfig @Settings
if ($PSCmdlet.ShouldProcess('Module config', 'Reset')) {
Set-GitHubConfig @Settings
}
}
38 changes: 38 additions & 0 deletions src/GitHub/private/Gitignore/Get-GitHubGitignoreByName.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
filter Get-GitHubGitignoreByName {
<#
.SYNOPSIS
Get a gitignore template

.DESCRIPTION
The API also allows fetching the source of a single template.
Use the raw [media type](https://docs.github.com/rest/overview/media-types/) to get the raw contents.

.EXAMPLE
Get-GitHubGitignoreList

Get all gitignore templates

.NOTES
https://docs.github.com/rest/gitignore/gitignore#get-a-gitignore-template

#>
[CmdletBinding()]
param (
[Parameter()]
[ValidateNotNullOrEmpty()]
[string] $Name
)

Process {
$inputObject = @{
APIEndpoint = "/gitignore/templates/$Name"
Accept = 'application/vnd.github.raw+json'
Method = 'GET'
}

Invoke-GitHubAPI @inputObject | ForEach-Object {
Write-Output $_.Response
}

}
}
32 changes: 32 additions & 0 deletions src/GitHub/private/Gitignore/Get-GitHubGitignoreList.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
filter Get-GitHubGitignoreList {
<#
.SYNOPSIS
Get all gitignore templates

.DESCRIPTION
List all templates available to pass as an option when
[creating a repository](https://docs.github.com/rest/repos/repos#create-a-repository-for-the-authenticated-user).

.EXAMPLE
Get-GitHubGitignoreList

Get all gitignore templates

.NOTES
https://docs.github.com/rest/gitignore/gitignore#get-all-gitignore-templates

#>
[OutputType([string[]])]
[CmdletBinding()]
param ()

$inputObject = @{
APIEndpoint = '/gitignore/templates'
Method = 'GET'
}

Invoke-GitHubAPI @inputObject | ForEach-Object {
Write-Output $_.Response
}

}
41 changes: 41 additions & 0 deletions src/GitHub/private/License/Get-GitHubLicenseByName.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
filter Get-GitHubLicenseByName {
<#
.SYNOPSIS
Get a license

.DESCRIPTION
Gets information about a specific license.
For more information, see "[Licensing a repository ](https://docs.github.com/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/licensing-a-repository)."

.EXAMPLE
Get-GitHubGitignoreList

Get all gitignore templates

.NOTES
https://docs.github.com/rest/licenses/licenses#get-a-license

#>
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')]
[CmdletBinding()]
param (
# The license keyword, license name, or license SPDX ID. For example, mit or mpl-2.0.
[Parameter()]
[ValidateNotNullOrEmpty()]
[Alias('license')]
[string] $Name
)

Process {
$inputObject = @{
APIEndpoint = "/licenses/$Name"
Accept = 'application/vnd.github+json'
Method = 'GET'
}

Invoke-GitHubAPI @inputObject | ForEach-Object {
Write-Output $_.Response
}

}
}
33 changes: 33 additions & 0 deletions src/GitHub/private/License/Get-GitHubLicenseList.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
filter Get-GitHubLicenseList {
<#
.SYNOPSIS
Get all commonly used licenses

.DESCRIPTION
Lists the most commonly used licenses on GitHub.
For more information, see "[Licensing a repository ](https://docs.github.com/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/licensing-a-repository)."

.EXAMPLE
Get-GitHubLicenseList

Get all commonly used licenses.

.NOTES
https://docs.github.com/rest/licenses/licenses#get-all-commonly-used-licenses

#>
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')]
[OutputType([string[]])]
[CmdletBinding()]
param ()

$inputObject = @{
APIEndpoint = '/licenses'
Method = 'GET'
}

Invoke-GitHubAPI @inputObject | ForEach-Object {
Write-Output $_.Response
}

}
Loading