auto-assign-review-teams icon indicating copy to clipboard operation
auto-assign-review-teams copied to clipboard

Exlcuding draft PRs doesn't work

Open GrahamBorland opened this issue 5 years ago • 5 comments

Using v1.0.0 of this action, the action runs on PRs which are created as Draft, and which have never been moved to the Open/ready-for-review state.

I have set include-draft: false in the config:

name: "Assign Reviewers"
on:  
  pull_request:
    types: [opened, ready_for_review]

jobs:
  assign-reviewers:
    runs-on: ubuntu-latest
    steps:
    - name: "Request review from Android team"
      uses: rowi1de/[email protected]
      with:
        repo-token: ${{ secrets.YBOT_ACCESS_TOKEN }}
        teams: "android"                # only works for GitHub Organisation/Teams
        persons: ""                     # add individual persons here 
        include-draft: false            # Draft PRs will be skipped (default: false)

Is there something else I need to do to exclude Draft PRs?

GrahamBorland avatar Apr 15 '20 19:04 GrahamBorland

Hey @GrahamBorland,

do you have an exmaple PR? Or can you share the logs?

rowi1de avatar Jul 21 '20 12:07 rowi1de

@rowi1de I don't have any recent logs or public PRs, I'm afraid. I ended up working around it by changing the config so that the action only runs when PRs are explicitly moved to the ready_for_review state. This solved the problem for us where the action would run on newly created draft PRs.

types: [ready_for_review]

GrahamBorland avatar Jul 21 '20 16:07 GrahamBorland

Ok I wasn't able to replicate the issue.

rowi1de avatar Jul 21 '20 16:07 rowi1de

@rowi1de I have a public repo that demonstrates this issue with the latest (v.1.0.1) version of the action.

  • Repo: https://github.com/stkent/GitHubActionsTesting
  • PR that was opened in draft state: https://github.com/stkent/GitHubActionsTesting/pull/11
  • Action run for that PR opened event: https://github.com/stkent/GitHubActionsTesting/actions/runs/233009449
     name: "Assign pr-bot"
     on:
       pull_request:
         types: [opened,ready_for_review]
    
     jobs:
       assign-reviewers:
         runs-on: ubuntu-latest
         steps:
         - name: "Request review from pr-bot"
           uses: rowi1de/[email protected]
           with:
             repo-token: ${{ secrets.REPO_TOKEN }}
             persons: "pr-bot"
             include-draft: false
    

I expected there to be no reviewer assigned as this PR is a draft.

But the workflow ran with the following output: https://github.com/stkent/GitHubActionsTesting/pull/11/checks?check_run_id=1052303655

Run rowi1de/[email protected]
  with:
    repo-token: ***
    persons: pr-bot
    include-draft: false
Adding persons: pr-bot
Request Status:201, Persons: pr-bot
Adding teams: 
Request Status:201, Teams:

and did indeed assign pr-bot to the PR.

I confirmed by fetching the PR details from the GitHub API manually that "draft": true is set for this PR.

Please reopen the issue and investigate! Let me know if you need any more information from me :) Thanks!

stkent avatar Aug 31 '20 17:08 stkent

Please reopen this issue !

I'm also having similar problems

adipatel avatar Jan 22 '21 15:01 adipatel