features: host override, dynamic pull and commit msg body - #41
Conversation
* read repo / host from package.json if not specified * accept command line or config file arguments for similar props * generates pull request body and commit message body dynamically based on diff of what was updated * documentation updates to match above
|
Thanks for the PR @shcarrico 😄 . I was actually planning on adding messages in the PR body, since you did it, its wonderful 🎉 . I will give it a shot later today and merge it! I don't think there is a breaking change right? I was thinking to bump the version to |
|
hey @shcarrico, apologies in delay in going thru this. Everything looks good, except few changes I put in comments :). I tried to update it, but dont have access to the repo you are PR'ing from. Would be nice you can update and I can merge 🎉 and also resolve conflicts 👼 |
| if (pkg) { | ||
| const pkgRepo = pkg.repository.url || pkg.repository; | ||
| const pkgGit = gitUrl(pkgRepo); | ||
| host = `${pkgGit.host}/api/v3`; |
There was a problem hiding this comment.
I dont think, we need to override it. Because normally the API path should be api.github.com, unless you setup the host in .santari.json.
There was a problem hiding this comment.
I was trying to match the api path with the supported api version for the client.. normally, this is done for you because you don't supply the host, but in this case if you do supply it i need it with the /api/v3 to work in the later call to github.client(config.token, { hostname: config.host }). The host is being read from the package.json repository settings here, specifically so you don't have to override it in .santari.json. this may be confusing because I am both loading package.json and .santari.json in the same function..
| } | ||
| } No newline at end of file | ||
| "title": "PR title", | ||
| "body": "PR Body" |
There was a problem hiding this comment.
We can remove title and body from demo config :). Atleast we can show the pr body being populated.
|
Example here: jeremyrajan/json-markdown#23 |
| this.depBranchName = `update-deps-santari-${Math.ceil(Math.random() * 100000)}`; | ||
| this.mainBranch = 'master'; | ||
| this.mainBranch = config.branch || 'master'; | ||
| this.commitMsg = config.msg || 'chore(package.json): update dependencies\n'; |
There was a problem hiding this comment.
May be we can use a different key, like commitMessage instead of msg ?
|
I will get on this tomorrow! |
|
@shcarrico did you get some time to update this? :) |
This is a somewhat opinionated pull. 😺
TLDR, this makes it possible to run just
santari --token your_token. (You can also still use environment variable as before). All other required info is derived from your projectspackage.jsonby default.It also creates dynamic PR and commit messages by using a diff of the existing vs updated dependency lists.
repoto your config file, or specify on cli as before--tokenas well asGITHUB_KEYenvironment variable.santari.jsonwithout specifying via--config, -cfirst, then will look for argument pathGITHUB_KEYenv variable, then config file props, then cli args to allow for override, ie, the CLI arguments always win, then config file, then environment var..optioncallexample commit message:
example pull request body: