Hub: How to add a PR description to a `hub pull-request` ?

Created on 19 Nov 2015  路  5Comments  路  Source: github/hub

Hello,

I'm loving this command line tool. We use it a lot in our CI scripts to automate workflows between git submodules and repositories. So thanks a lot!

I'm trying to add a description to the PR I'm creating using hub pull-request without much success. The use case is we update a submodule, and we construct the URL of the Github comparison between the old and new submodule hashes to add it as a description to the PR.

I've tried giving a multine HEREDOC input to -m, but it breaks hub internally. I've also tried not setting any message at all, but the tool opens $EDITOR and expects a human to write a message manually, which is a no-go for our CI tool (instead of using the last commit's message and extended description as in Github's web interface, as I was expecting)

Is there any other way I could do this?

Thanks again!

Most helpful comment

The subject and the body need to be separated by a blank line.

hub pull-request -F- <<<"THIS IS THE SUBJECT
THIS IS SECOND LINE OF SUBJECT

This is the body.
This is the second line of body.

This will all be body."

All 5 comments

You could use the -F flag on hub pull-request similar to git-commit and pass a generated file. See https://hub.github.com/#work for an example.

Thank you very much @hkdobrev! That did it!

This doesn't work. The entire string is put into PR's headline and description is empty.

At least when I try to do it like that:

            export MESSAGE="
              Job $CIRCLE_BUILD_NUM $CIRCLE_BUILD_URL
              Github diff $CIRCLE_COMPARE_URL
              Github PR $CIRCLE_PULL_REQUEST
              User $CIRCLE_USERNAME
              Workflow ID $CIRCLE_WORKFLOW_ID"

            hub pull-request -F- <<< "$MESSAGE"

The subject and the body need to be separated by a blank line.

hub pull-request -F- <<<"THIS IS THE SUBJECT
THIS IS SECOND LINE OF SUBJECT

This is the body.
This is the second line of body.

This will all be body."

Yup, it works. Thank you very much @mislav !

Was this page helpful?
0 / 5 - 0 ratings