Closed variableresistor closed 1 year ago
Turns out unit tests aren't working. My mistake. Getting:
[-] Context GitHubRepositories\New-GitHubRepository.When creating a repository for the authenticated user.When creating a private repository with default settings failed
[0] HttpResponseException: Response status code does not indicate success: 404 (Not Found).
at Invoke-GHRestMethod, C:\Repos\PowerShellForGitHub\GitHubCore.ps1:320
at Remove-GitHubRepository, C:\Repos\PowerShellForGitHub\GitHubRepositories.ps1:525
at
Strangely, some tests are still passing: Tests completed in 33.74s Tests Passed: 9, Failed: 6, Skipped: 0 NotRun: 133 BeforeAll \ AfterAll failed: 3
Works okay when I run this:
$Repo = New-GitHubRepository -Name (New-Guid) -Discussions
$Repo.has_discussions
True
Been going in circles on this for an hour. Read all the contributing docs in the repo. Doesn't even work when I revert my change.
Been going in circles on this for an hour. Read all the contributing docs in the repo. Doesn't even work when I revert my change.
It looks like you're not sync'd up with what's currently in main.
Been going in circles on this for an hour. Read all the contributing docs in the repo. Doesn't even work when I revert my change.
It looks like you're not sync'd up with what's currently in main.
Yeah, that makes sense; I'm probably not getting all the Pester 5+ changes. My repo says it's up to date with the main branch, but it's clearly not. So can I just close out this PR, re-create my fork, then open a new one?
Yeah, that makes sense; I'm probably not getting all the Pester 5+ changes. My repo says it's up to date with the main branch, but it's clearly not. So can I just close out this PR, re-create my fork, then open a new one?
That's overkill. No need to do that. You just need to merge the current changes in master
.
First, add a named branch for upstream:
git remote add upstream https://github.com/microsoft/PowerShellForGitHub.git
After that, it's easy to do operations in your fork that interact with this project. This will get your fork's master fully in-sync with this one.
git checkout master
git pull upstream master
git push
Finally, just rebase your branch on top of your local master
git checkout <your local branch name>
git rebase master
git push -f
After that, your fork will be modifying on top of the current change in this project's master
.
@HowardWolosky okay, my change is actually working here. It's in the context "When creating a repository with all possible settings". It's the context "When creating a private repository with default settings" that's not working. It uses the same function to run both, but my new -Discussions parameter isn't even being added to the header. So I'm starting to believe it's a different issue. Here's some relevent variables I inspected during the test run:
$params
Name Value
---- -----
TelemetryEventName New-GitHubRepository
Method Post
UriFragment user/repos
AcceptHeader application/vnd.github.baptiste-preview+json
TelemetryProperties {RepositoryName}
Body {…
Description Creating 359474aa-4bfa-4fc2-8718-d60b1bea7626
AccessToken
PS C:\Repos\PowerShellForGitHub> $params.Body
{
"name": "359474aa-4bfa-4fc2-8718-d60b1bea7626",
"private": true
}
Line 222 in GitHubRepositories.ps1 while running Context -Name 'When creating a private repository with default settings'
Error:
HttpResponseException: Response status code does not indicate success: 500 (Internal Server Error)
I'm not seeing the test failures that you're describing when running your changes locally.
This parameter should also be added to the Set-GitHubRepository
function.
This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 14 days of this comment.
This parameter should also be added to the
Set-GitHubRepository
function.
This would make sense, but the GitHub docs don't show has_discussions as a parameter to update a repository.
No, but it does work (I tried it). I think the documentation is incomplete.
No, but it does work (I tried it). I think the documentation is incomplete.
I pushed the change right before I saw your comment. Changing the other as well.
/azp run PowerShellForGitHub-CI
Description
Allow the user to enable Discussions in Github repositories
Issues Fixed
Fixes #378
References
https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#update-a-repository
Checklist
- [ ] Formatters were created for any new types being added.- [ ] Changes to the manifest file follow the manifest guidance.- [ ] Relevant usage examples have been added/updated in USAGE.md.