From 381ef1c2d1d79495bf12d3db2b6a0bf4b93c62ff Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Fri, 15 Aug 2025 14:05:00 -0700 Subject: [PATCH] fix: do not run on draft PRs --- actions/detailed-review/action.yml | 15 ++++++++++----- actions/general-review/action.yml | 15 ++++++++++----- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/actions/detailed-review/action.yml b/actions/detailed-review/action.yml index e0280fa28..e3c7c34e8 100644 --- a/actions/detailed-review/action.yml +++ b/actions/detailed-review/action.yml @@ -29,12 +29,17 @@ runs: SHOULD_RUN="false" if [ "${{ github.event_name }}" = "pull_request" ]; then - # Check PR author association - AUTHOR_ASSOC="${{ github.event.pull_request.author_association }}" - if [ "$AUTHOR_ASSOC" = "OWNER" ] || [ "$AUTHOR_ASSOC" = "MEMBER" ] || [ "$AUTHOR_ASSOC" = "COLLABORATOR" ]; then - SHOULD_RUN="true" + # Check if PR is a draft + if [ "${{ github.event.pull_request.draft }}" = "true" ]; then + echo "::notice::Skipping review - PR is a draft" else - echo "::notice::Skipping review - PR author is not a team member (association: $AUTHOR_ASSOC)" + # Check PR author association + AUTHOR_ASSOC="${{ github.event.pull_request.author_association }}" + if [ "$AUTHOR_ASSOC" = "OWNER" ] || [ "$AUTHOR_ASSOC" = "MEMBER" ] || [ "$AUTHOR_ASSOC" = "COLLABORATOR" ]; then + SHOULD_RUN="true" + else + echo "::notice::Skipping review - PR author is not a team member (association: $AUTHOR_ASSOC)" + fi fi elif [ "${{ github.event_name }}" = "issue_comment" ]; then # Check if it's a PR comment with the trigger phrase diff --git a/actions/general-review/action.yml b/actions/general-review/action.yml index 060494b94..bf5e221e1 100644 --- a/actions/general-review/action.yml +++ b/actions/general-review/action.yml @@ -29,12 +29,17 @@ runs: SHOULD_RUN="false" if [ "${{ github.event_name }}" = "pull_request" ]; then - # Check PR author association - AUTHOR_ASSOC="${{ github.event.pull_request.author_association }}" - if [ "$AUTHOR_ASSOC" = "OWNER" ] || [ "$AUTHOR_ASSOC" = "MEMBER" ] || [ "$AUTHOR_ASSOC" = "COLLABORATOR" ]; then - SHOULD_RUN="true" + # Check if PR is a draft + if [ "${{ github.event.pull_request.draft }}" = "true" ]; then + echo "::notice::Skipping review - PR is a draft" else - echo "::notice::Skipping review - PR author is not a team member (association: $AUTHOR_ASSOC)" + # Check PR author association + AUTHOR_ASSOC="${{ github.event.pull_request.author_association }}" + if [ "$AUTHOR_ASSOC" = "OWNER" ] || [ "$AUTHOR_ASSOC" = "MEMBER" ] || [ "$AUTHOR_ASSOC" = "COLLABORATOR" ]; then + SHOULD_RUN="true" + else + echo "::notice::Skipping review - PR author is not a team member (association: $AUTHOR_ASSOC)" + fi fi elif [ "${{ github.event_name }}" = "issue_comment" ]; then # Check if it's a PR comment with the trigger phrase