vsoch / pull-request-action

open a pull request when a branch is pushed or updated
https://github.com/marketplace/actions/pull-request-action
MIT License
174 stars 62 forks source link

Add support for assigning reviewers #19

Closed satishjuvo88 closed 4 years ago

satishjuvo88 commented 4 years ago

Currently, my use case is to create automated PRs and set the reviewers. However, I wish that there is someway to retrieve the title and message as how github does when we open a PR. Title is the title of the first commit and message is the message of the first commit.

vsoch commented 4 years ago

So you are interested in having a variable for the commit message? Note that commits don't really have a title, it would just be the first line of the commit message (and if I am wrong / misunderstand please show me an example so I know what you mean!)

satishjuvo88 commented 4 years ago

you are correct, it is the first line of the commit message that im hoping to use as the title. I always use the first line to automatically make the title when i manually raise the PR such that I do not have to manually type the title.

vsoch commented 4 years ago

If you want to set the title, then just set:

PULL_REQUEST_TITLE: the title for the pull request (optional)

and see the README for other variables.

satishjuvo88 commented 4 years ago

PULL_REQUEST_TITLE: the title for the pull request (optional)

How do i make the title dynamic based on each PR's commit's last message?

currently if i entered

PULL_REQUEST_TITLE: test title

All PR will have 'test title' as the PR title, but i want the title to be pulled from the commit first line automatically and dynamically

vsoch commented 4 years ago

You would run some pipeline step before it in your workflow and then set it as an environment variable to make available for the next step.

vsoch commented 4 years ago

Here is how you do that: https://help.github.com/en/actions/reference/development-tools-for-github-actions#set-an-environment-variable-set-env

satishjuvo88 commented 4 years ago

@vsoch just wanted to share that i eventually got the "github.event.head_commit.message" and split it with the seperator being '/n' and i got the PR Title as per when manually opening a PR :)

vsoch commented 4 years ago

Oh interesting, so you wanted to get the commit message from the last commit already associated with the branch? Sorry I misunderstood, glad that you figured it out and that is for sharing the trick!

satishjuvo88 commented 4 years ago

Actually, I am looking at the first commit's message.

Yes, my objective when i set out to use actions was to automate the whole process of opening a Pr when we push a branch to remote. So it needs to be exactly how i would open a PR when i click on the button on the webpage to open a PR and creating it.

Also, i had another question of whether we can assign teams to review using your actions?

vsoch commented 4 years ago

There was another request to assign reviewers, but it wasn’t integrated. Would you be interested in this feature, and if so, would you be willing to test a PR branch? If so, I can make some time to work on it this week.

satishjuvo88 commented 4 years ago

I would be delighted to help. i assume that to test a PR branch i just switch

    uses: vsoch/pull-request-action@master

to

    uses: vsoch/pull-request-action@PR-branch

right?

vsoch commented 4 years ago

Yes, you got the idea! I have some triage (higher up in the list) things I need to work on, but I can definitely get this done for you within likely the week! Let's open the issue again and rename to be appropriate for this request.

vsoch commented 4 years ago

okay here you go! I created an example config in the description here to get you started. Please test and let me know how it goes!

https://github.com/vsoch/pull-request-action/pull/23

satishjuvo88 commented 4 years ago

Great, i will check it out.

satishjuvo88 commented 4 years ago

hi, can i check if this will add assignee or reviewers? Also, does this include Team reviewers?

vsoch commented 4 years ago

@satishjuvo88 I'm going to open a new issue to discuss this.