repo-file-sync-action icon indicating copy to clipboard operation
repo-file-sync-action copied to clipboard

Fix: Create Commit tree using GitHub API

Open alvarezfr opened this issue 2 years ago • 5 comments
trafficstars

Changes the way that we are creating GitHub trees, because we are hitting some problems on the GitHub side receiving 502 status code with no more information than "Server Error" when creating the tree using the API, and this kind of error is not documented in GitHub but I was able to found some other repositories referencing to this.

This PR changes the way that we create a git tree in GitHub. Now, instead of creating the full tree to commit, we create a new tree with only the changes and references to the git tree of the previous commit in the Create Tree API.

I found the issue https://github.com/BetaHuhn/repo-file-sync-action/issues/246 after getting the same error in some syncs. The code has been tested with my own repositories with this kind of error.

Also, why I changed some imports: I have changed the imports of fs-extra and nunjucks because while running the src/ code locally with node v16.20.2 I was getting an error saying the function fs.existsSync doesn't exist, but it was working just fine if I run the packaged dist version. After looking at the documentation, I changed it to the recommended.

But after making the previous change, I was receiving an error with the nunjuncks which said the function nunjucks.configure did not exist.

alvarezfr avatar Sep 04 '23 14:09 alvarezfr

Just tested this and fixed my issue.

skgsergio avatar Sep 28 '23 11:09 skgsergio

@BetaHuhn this PR was tested in our org, by only this change:

image

Please, could you review it? Thanks :)

svg153 avatar Oct 02 '23 16:10 svg153

Hi @BetaHuhn.

Do you think you could review this PR? Thank you!

alvarezfr avatar Jan 11 '24 12:01 alvarezfr

@BetaHuhn when do you think we can review and merge this PR?

kevinv-novibet avatar Jan 15 '24 14:01 kevinv-novibet

Hi @BetaHuhn,

Could you please review and merge this?

It solved our issue too Cannot create a new GitHub Tree: tree.sha XXXX is not a valid blob

Thanks!

mazilu88 avatar Feb 05 '24 07:02 mazilu88

:tada: This PR is included in version 1.21.1 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

BetaHuhnBot avatar May 05 '24 12:05 BetaHuhnBot