repo-file-sync-action
repo-file-sync-action copied to clipboard
Fix: Create Commit tree using GitHub API
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.
Just tested this and fixed my issue.
@BetaHuhn this PR was tested in our org, by only this change:
Please, could you review it? Thanks :)
Hi @BetaHuhn.
Do you think you could review this PR? Thank you!
@BetaHuhn when do you think we can review and merge this PR?
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!
:tada: This PR is included in version 1.21.1 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket: