feat: Add support for GitHub API commit#2046
Merged
olblak merged 4 commits intoupdatecli:mainfrom Apr 25, 2024
Merged
Conversation
Contributor
Author
|
@olblak Leaving this in draft for now as I am still doing some testing in our organization, but happy to get any feedback. I'll see if I can get some tests in as well when I get some more time. |
a34eb57 to
0686bc6
Compare
olblak
reviewed
Apr 24, 2024
olblak
reviewed
Apr 24, 2024
Member
|
Spelling issues can be ignored by adding them to https://github.com/updatecli/updatecli/blob/main/.github/actions/spelling/allow.txt |
This commit adds support for GitHub API commit. It allows to update a file in a GitHub repository using the GitHub API instead of using git. The GitHub API commit is useful when a user is using the automated token from Github Actions as it creates a signed commit automatically.
4b05bdd to
008d116
Compare
Contributor
Author
|
Added a pattern to remove spellcheck on lines where it didn't make sense which was a bit easier than having to add exclusions for base64 strings. 😄 |
008d116 to
3d63f8b
Compare
olblak
approved these changes
Apr 25, 2024
Member
olblak
left a comment
There was a problem hiding this comment.
Thanks for the pullrequest, it looks great.
I didn't test it yet, but I am planning to release a new release candidate 0.76.0-rc.2 so we can see how it behaves during a few days
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #1914
This pull request adds support for GitHub API commit. It allows Github SCM to commit a file in a GitHub repository using the GitHub API instead of using native Git.
The GitHub commit API is useful when a user is using the automated token from Github Actions as it creates a signed commit automatically, removing the requirement of using a bot account with a GPG key configured.
For now I've hidden this feature behind the
commitUsingApi(not loving the parameter name, happy for suggestions).In addition I changed the Github pull request action to check if working branch is ahead using the API instead of relying on the native Git handler as I kept running in to issues where Github Actions wasn't recognizing changes done (not exactly sure why, but I think this will 100% ensure that the commit is available in Github).
As can be seen in the below screenshot, the commit is shown as verified with the Github Actions bot user committing the changes.

Test
Build my fork and use the Github SCM with
commitUsingApi: true.