-
Notifications
You must be signed in to change notification settings - Fork 189
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
Add support for codespaces #407
Add support for codespaces #407
Conversation
- Stop-GitHubCodespace - Wait-GitHubCodespaceAction
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.
Thanks so much for this work, @vercellone!
This was in really great shape for a first contribution. I do have some feedback for you to address (please), but I don't anticipate it being a significant amount of work.
I'll admit that I had no idea that this GitHub feature even existed. I'm going to have to look to see what might be involved in getting a standard Codespace set up for this project (and some of my others).
Added
Keep the feedback coming. I'm particularly interested in your take on INPUTS, -Uri, -RepositoryId, and -PullRequest usage for New. I will work on Tests next when able. |
Good news Bad news |
Great!
At what point are you encountering this issue? In
PowerShellForGitHub/GitHubRepositories.ps1 Lines 3673 to 3702 in 6f94a9b
If you're encontering this issue elsewhere, then I'll need more context to know what and where the problem is. |
Co-authored-by: Howard Wolosky <[email protected]>
Co-authored-by: Howard Wolosky <[email protected]>
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.
Looks like you still have a couple failing tests.
Invoke-Pester -Configuration (
[PesterConfiguration]@{
Filter = @{ FullName = 'GitHubCodespaces\*-GitHubCodespace' }
Output = @{ Verbosity = 'Detailed' }
Path = 'C:\Users\Jason\source\GitHub\PowerShellForGitHub\Tests\GitHubCodespaces.tests.ps1'
}
)
Pester v5.4.1
Starting discovery in 28 files.
Discovery found 1128 tests in 616ms.
Filter 'FullName' set to ('GitHubCodespaces\*-GitHubCodespace').
Filters selected 30 tests to run.
Running tests.
Running tests from 'C:\Users\Jason\source\GitHub\PowerShellForGitHub\Tests\GitHubCodespaces.tests.ps1'
Describing GitHubCodespaces\Delete-GitHubCodespace
Context When deleting a codespace for the authenticated user
[+] Should get no content using -Confirm:$false 15.06s (15.06s|2ms)
[+] Should get no content using -Force 15.02s (15.02s|1ms)
Describing GitHubCodespaces\Get-GitHubCodespace
Context When getting codespaces for the authenticated user
[+] Should return objects of the correct type 3ms (2ms|2ms)
[+] Should return one or more results 3ms (2ms|1ms)
[+] Should return the correct properties 2ms (2ms|1ms)
Context When getting a codespace for a specified owner and repository
[+] Should return objects of the correct type 3ms (2ms|1ms)
[+] Should return one or more results 3ms (2ms|1ms)
[+] Should return the correct properties 3ms (2ms|1ms)
Context When getting a codespace for a specified organization user
[+] Should have results for the organization user 4ms (3ms|1ms)
[+] Should return the correct properties 3ms (2ms|1ms)
Context When getting a codespace for a specified codespace name
[+] Should return objects of the correct type 3ms (2ms|1ms)
[+] Should return the correct properties 2ms (2ms|1ms)
Context When specifiying the Uri parameter
[+] Should return objects of the correct type 3ms (2ms|1ms)
[+] Should return the correct properties 3ms (2ms|1ms)
Context When specifiying the Uri parameter from the pipeline
[+] Should return objects of the correct type 4ms (2ms|1ms)
[+] Should return the correct properties 2ms (2ms|1ms)
Describing GitHubCodespaces\New-GitHubCodespace
Context When creating a repository for the authenticated user
Context When creating a codespace with default settings with RepositoryId
[+] Should return an object of the correct type 10ms (6ms|3ms)
[+] Should return the correct properties 4ms (3ms|1ms)
Context When creating a codespace with default settings with Ref
[+] Should return an object of the correct type 4ms (2ms|2ms)
[+] Should return the correct properties 4ms (3ms|1ms)
Context When creating a codespace with default settings from a PullRequest
[+] Should return an object of the correct type 3ms (2ms|1ms)
[+] Should return the correct properties 4ms (3ms|1ms)
Context When creating a codespace with all possible settings
[+] Should return an object of the correct type 3ms (2ms|1ms)
[+] Should return the correct properties 7ms (7ms|1ms)
Context When creating a codespace with default settings with Repository Elements
[+] Should return an object of the correct type 3ms (2ms|1ms)
[+] Should return the correct properties 4ms (3ms|1ms)
Describing GitHubCodespaces\Start-GitHubCodespace
Context When starting a codespace for the authenticated user
[+] Should not throw 4.26s (4.25s|2ms)
[+] Should become Available 7.48s (7.48s|1ms)
Describing GitHubCodespaces\Stop-GitHubCodespace
Context When stopping a codespace for the authenticated user
[+] Should not throw 3.9s (3.9s|3ms)
[+] Should become Shutdown 6.78s (6.78s|1ms)
Tests completed in 206.51s
Tests Passed: 30, Failed: 0, Skipped: 0 NotRun: 1098 |
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.
Still seeing two test failures:
[-] GitHubCodespaces\Get-GitHubCodespace.When getting codespaces for the authenticated user.Should return one or more results 44ms (42ms|2ms) Expected the actual value to be greater than or equal to 1, but got $null. at ($codespaces | Where-Object { $_ }).Count | Should -BeGreaterOrEqual 1, C:\Source\PowerShellForGitHub\tests\GitHubCodespaces.tests.ps1:88 at <ScriptBlock>, C:\Source\PowerShellForGitHub\tests\GitHubCodespaces.tests.ps1:88 [-] GitHubCodespaces\Get-GitHubCodespace.When getting a codespace for a specified owner and repository.Should return one or more results 12ms (11ms|1ms) Expected the actual value to be greater than or equal to 1, but got $null. at ($codespaces | Where-Object { $_ }).Count | Should -BeGreaterOrEqual 1, C:\Source\PowerShellForGitHub\tests\GitHubCodespaces.tests.ps1:110 at <ScriptBlock>, C:\Source\PowerShellForGitHub\tests\GitHubCodespaces.tests.ps1:110
Thanks for the quick responses this week. I could not reproduce these last 2 test failures in pwsh 7.3.6, but I was able to reproduce them in Windows PowerShell 5.1. They require an @ symbol before the ($codespaces...).Count to force the result to an Object[] array and avoid the InvokeMethodOnNull exception. I think we should be good now. |
Can you also add PowerShellForGitHub/GitHubCore.ps1 Lines 990 to 1008 in 482fe23
|
last_used_at added to datePropertyNames |
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.
Thanks so much for all your hard work in getting this support added. Very much appreciated. Looking forward to hitting the button to merge this.
Description
Add support for Codespaces.
Issues Fixed
References
Endpoints
excludedbelow will be added in subsequent PRsCodespaces/codespaces
List devcontainer configurations in a repository for the authenticated userGet default attributes for a codespaceUpdate a codespace for the authenticated userExport a codespace for the authenticated userGet details about a codespace exportCreate a repository from an unpublished codespaceCodespaces/organizations
Manage access control for organization codespacesAdd users to Codespaces billing for an organizationRemoves users from Codespaces billing for an organizationStop a codespace for an organization userChecklist