microsoft / PowerShellForGitHub

Microsoft PowerShell wrapper for GitHub API
Other
582 stars 184 forks source link

API Completeness - Repositories - Content #150

Open raghav710 opened 4 years ago

raghav710 commented 4 years ago

Tracking the addition of methods fo https://developer.github.com/v3/repos/contents

raghav710 commented 4 years ago

@HowardWolosky realized that this is needed for my other PRs (merging branches, updating refs). Would we be okay to get them merged and I can add test cases when I add this feature. Or would we want to push this in first?

HowardWolosky commented 4 years ago

@Shazwazza just added the Get contents method. They were interested in adding the create/update method next. @raghav710, were you looking to do this yourself, or were you just trying to track the need for it?

raghav710 commented 4 years ago

@HowardWolosky that's great to know. I'm happy if @Shazwazza can take up create/update as well.

I just needed Content related APIs for writing the tests for my PRs and not especially wanting to do it by myself 👍

Hope you are fine. Stay safe 👍

damienvanrobaeys commented 4 years ago

Regarding the uploading part, I'm able to upload file (zip, rar, exe, pS1, txt, pdf ...) on github using the below code:

$File_To_Upload = Read-Host "Type the path of the file to upload" $Get_File_Name = (Get-ChildItem $File_To_Upload).name
$Encoded_File = [System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes("$File_To_Uplo

{ "message": "", "content": "$Encoded_File" } "@

Invoke-GHRestMethod -UriFragment "https://api.github.com/repos/$owner/$repositoryname/contents/$Get_File_Name" -Method PUT -Body $MyFile_JSON

HowardWolosky commented 4 years ago

Bumping this up to see if anyone is actively working on this. Two of the existing tests in GitHubContents.tests.ps1 are currently brittle because they start to fail anytime GitHub changes the default HTML presentation of their README.md file: Context 'For getting html (byte) file contents' and Context 'For getting html (string) file contents'

raghav710 commented 4 years ago

@HowardWolosky I'm not working on this currently. But I can take this up after my existing PRs are done, if no one takes it up by then

Shazwazza commented 4 years ago

Hi all, I don't have a whole lot of time at the moment so would be great if you could pick it up if you've got the time. I'll check back in a couple weeks when I hopefully have some extra time and see what the status is.

X-Guardian commented 4 years ago

Create or update a file has been completed in PR #241.