-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build: Sdk code generation #32
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really nice, I had no idea you could make a github action so easily.
Just have some very minor optional suggestions.
# | ||
# ============================================================ | ||
|
||
git config credential.helper '!f() { sleep 1; echo "username=${GITHUB_USER}"; echo "password=${GITHUB_TOKEN}"; }; f' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you could also use the github cli for this:
https://cli.github.com/manual/gh_auth_login
gh auth login --with-token < ${GITHUB_TOKEN}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that seems simpler than what we have here.
- [$INDEXER_SPEC_HASH]($INDEXER_REPO_URL/commit/$INDEXER_SPEC_HASH) - $INDEXER_SPEC_COMMIT_MSG | ||
|
||
|
||
> **Disclaimer:** I'm just a bot. Feel free to make changes to this pull request as needed." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice touch with this PR body and links to the spec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks but I can't really take credit as I copied this over from https://github.com/algorand/generator/blob/master/automation/publish.sh#L109 😸
Co-authored-by: Will Winder <wwinder.unh@gmail.com>
Co-authored-by: Will Winder <wwinder.unh@gmail.com>
Co-authored-by: Will Winder <wwinder.unh@gmail.com>
Co-authored-by: Will Winder <wwinder.unh@gmail.com>
Co-authored-by: Will Winder <wwinder.unh@gmail.com>
Summary
Adds a github action which can be used by SDKs to automatically generate code and open pull requests.
Currently this automation resides in https://github.com/algorand/generator/tree/master/automation as well as in some of the SDK repos themselves, but it has some issues from lack of maintenance and isn't being used.
The
publish.sh
file I've taken nearly exactly from what the existing script as it just works.The
entrypoint.sh
is a mix of thescripts/generate_{language}.sh
and the existingDockerfile
in the automation.I've moved all of this into a Github Action so that we can have a central location that defines our code generation logic, and then utilize that across each of our SDK repos via a nightly workflow.
Testing
I've run the workflow on my personal forks (so there may be some permissions issues to sort out once we merge this), and have successful runs for generating a PR:
https://github.com/Eric-Warehime/go-algorand-sdk/actions/runs/2386518280
Eric-Warehime/go-algorand-sdk#1 (comes from an outdated indexer API spec so ignore the content)
And I have gotten a run which successfully no-ops because the branch with generated changes already exists:
https://github.com/Eric-Warehime/go-algorand-sdk/actions/runs/2386615221