Skip to content
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

Customizeable commit messages #241

Closed
wants to merge 2 commits into from
Closed

Customizeable commit messages #241

wants to merge 2 commits into from

Conversation

TheKevJames
Copy link

Hi @jayfk! We spoke via email a while ago about allowing for customizable commit messages; this PR is meant to implement that feature.

This commit allows for commit messages to be modified in .pyup.yml. The documentation will need to be updated with something like the following blob:

# configure commit messages for pinned dependencies
# default: "Pin {name} to latest version {new_version}"
# allowed: any string containing format strings {name}, {old_version}, and/or {new_version}
commit_msg_pin: "Pin {name} to latest version {new_version}"

# configure commit messages for un-pinned dependencies
# default: "Update {name} from {old_version} to {new_version}"
# allowed: any string containing format strings {name}, {old_version}, and/or {new_version}
commit_msg_update: "Update {name} from {old_version} to {new_version}"

I did not see any method of updating the docs from this code-base (did I miss something in docs/?), but would be happy to do that update if you could point me in the right direction.

@codecov
Copy link

codecov bot commented Aug 3, 2017

Codecov Report

Merging #241 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #241      +/-   ##
==========================================
+ Coverage   97.15%   97.16%   +<.01%     
==========================================
  Files          10       10              
  Lines         984      986       +2     
==========================================
+ Hits          956      958       +2     
  Misses         28       28
Impacted Files Coverage Δ
pyup/updates.py 100% <100%> (ø) ⬆️
pyup/config.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 29856d7...375e219. Read the comment docs.

@jayfk
Copy link
Contributor

jayfk commented Aug 3, 2017

Thanks, that's awesome!

I don't have the time to review this today, but I will check this out as soon as I can.

@jayfk
Copy link
Contributor

jayfk commented Aug 14, 2017

Okay, it's a bit more complicated. I've missed to document this properly: The bot is getting almost all of its state from the pull request titles. This makes it easy to switch between the online service running on pyup.io and the command line client without needing some kind of database.

This includes the version, the package and the type (update, initial, scheduled or pin). This enables the bot to see what's already there and close stale PRs if necessary.

Now, the tricky part is to parse this correctly if the title is user-editable.

Currently it's super simple...

"Update django .."
"Pin flask ..."
"{type} {package} ..."

... which allows to simply check if the title begins with one of the keywords to match the type and to split the string to determine what package is involved.

I can't come up with a good solution for this problem if the pull request title is fully customisable. Any ideas?

@khornberg
Copy link
Contributor

Can areas of the commit message be customizable? e.g.
{prefix} {type-cannot change} {package-cannot change} {suffix}

@TheKevJames
Copy link
Author

Ah shit, this PR got completely lost from my TODO list. Thanks for the bump @khornberg, I'll slot out some time to look into this in the near future (hopefully!)

@TheKevJames
Copy link
Author

@jayfk I've clearly been having some issues finding the time to work on this haha :)

Hmm, here's my thoughts on fixing the issue you brought up: the PR title and the commit message don't have to be the same thing. Could we make the commit message customizable but hard-code the PR title?

@TheKevJames
Copy link
Author

Well, this managed to fall off my radar again. Looks like someone eventually found the time to implement this as setting pr_prefix in your pyup config, which is great! Closing this since that covers the use case.

@TheKevJames TheKevJames closed this Feb 2, 2018
@TheKevJames TheKevJames deleted the customizeable-commit-messages branch February 2, 2018 00:41
@jayfk
Copy link
Contributor

jayfk commented Feb 2, 2018

Thanks for your work on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants