diff --git a/.github/workflows/sourcery_code_review.yaml b/.github/workflows/sourcery_code_review.yaml index b7e706b..adc54af 100644 --- a/.github/workflows/sourcery_code_review.yaml +++ b/.github/workflows/sourcery_code_review.yaml @@ -8,7 +8,8 @@ on: types: # Trigger the review when either of these events occur: # - # - a review is requested from any user + # - a pull request is opened and is not in draft state + # - a pull request is moved from draft to ready for review # - the "sourcery-review" label is added to the pull request: add this label # to your pull request to trigger a review. To re-request reviews, remove the # label and add it again. @@ -16,7 +17,8 @@ on: # Feel free to edit this list to suit your team's needs. See the list of all # activity types here: # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request - - review_requested + - opened + - ready_for_review - labeled permissions: @@ -27,11 +29,13 @@ permissions: jobs: sourcery-coding-assistant-review: - # Only run this job when a review is requested or the "sourcery-review" - # label is added to the pull request. + # Only run this job when a PR is opened and is not in draft state, + # is moved from draft to ready for review, + # or the "sourcery-review" label is added to the pull request. if: | - github.event.action == 'review_requested' || - github.event.label.name == 'sourcery-review' + github.event.action == 'opened' && !github.event.pull_request.draft || + github.event.action == 'ready_for_review' || + github.event.action == 'labeled' && github.event.label.name == 'sourcery-review' runs-on: ubuntu-latest