-
Notifications
You must be signed in to change notification settings - Fork 2
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
features: host override, dynamic pull and commit msg body #41
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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..
"title": "PR title", | ||
"body": "PR Body" |
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.
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.masterSHA = ''; // master SHA | ||
this.packageSHA = ''; // package JSON SHA | ||
this.packagePath = ''; // package path from repo | ||
this.packageJSON = ''; // JSON parsed version of repo package | ||
this.packageTempPath = ''; // package path where temp package is stored. To be used by ncu | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.json
by default.It also creates dynamic PR and commit messages by using a diff of the existing vs updated dependency lists.
repo
to your config file, or specify on cli as before--token
as well asGITHUB_KEY
environment variable.santari.json
without specifying via--config, -c
first, then will look for argument pathGITHUB_KEY
env variable, then config file props, then cli args to allow for override, ie, the CLI arguments always win, then config file, then environment var..option
callexample commit message:
example pull request body: