reviewdog / action-eslint

Run eslint with reviewdog
https://github.com/marketplace?type=actions&query=reviewdog
MIT License
237 stars 63 forks source link

Only run on pull requests that are "ready for review" not "draft" pull request. #29

Closed ChadTaljaardt closed 4 years ago

ChadTaljaardt commented 4 years ago

Hello,

Is there a way to make this only run on pull requests which are ready for review instead of draft pull requests.

I tried adding the following type to "ready_for_review" which only gets run when marking the PR ready for review, but not on code changes then. So i added synchronize to make it work on code changes, but it runs on code changes even in draft pull requests.

I want it to only run on code changes on pull request which are ready for review.

haya14busa commented 4 years ago

There is if expression in GitHub Actions, so you can implement filtering outside action-eslint. https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idif

ChadTaljaardt commented 4 years ago

Thanks for the pointer, ill look into it 👍

odimko commented 3 years ago

but how would you check if a PR is ready for review @haya14busa ? that page just introduces if-statements, but not an actually expression to do so. any hints? :)

timusus commented 2 years ago

@odimko

In your job, you can use the statement:

jobs:
  my_job:
    name: "Job Name"
    runs-on: ubuntu-latest
    if: ${{ !github.event.pull_request.draft }}

To ensure the job will not run against PR drafts.

But, you probably also want the job to run when the PR status changes from draft to 'ready for review'

As per the docs, the default 'types' of pull-request that trigger your CI are opened, reopened and synchronize. You need to specify ready_for_review. And, since you probably want the default as well, you will need to specify those explicitly:

name: Action Name

on:
  pull_request:
    branches: [my_branch]
    types:
      - opened
      - reopened
      - synchronize
      - ready_for_review