Skip to content

Commit

Permalink
Refine when Props Bot runs (#58616)
Browse files Browse the repository at this point in the history
* Don't run Props Bot for draft or closed PRs.

* Add `ready_for_review` as an event.

Co-authored-by: desrosj <desrosj@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: gziolo <gziolo@git.wordpress.org>
  • Loading branch information
4 people authored Feb 2, 2024
1 parent 3ebf741 commit 87689b3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/props-bot.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Props Bot

on:
# This event runs anytime a PR is (re)opened, updated, or labeled.
# This event runs anytime a PR is (re)opened, updated, marked ready for review, or labeled.
# GitHub does not allow filtering the `labeled` event by a specific label.
# However, the logic below will short-circuit the workflow when the `props-bot` label is not the one being added.
# Note: The pull_request_target event is uesed instead of pull_request because this workflow needs permission to comment
# Note: The pull_request_target event is used instead of pull_request because this workflow needs permission to comment
# on the pull request. Because this event grants extra permissions to `GITHUB_TOKEN`, any code changes within the PR
# should be considered untrusted. See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/.
pull_request_target:
Expand All @@ -13,6 +13,7 @@ on:
- synchronize
- reopened
- labeled
- ready_for_review
# This event runs anytime a comment is added or deleted.
# You cannot filter this event for PR comments only.
# However, the logic below does short-circuit the workflow for issues.
Expand Down Expand Up @@ -64,7 +65,7 @@ jobs:
if: |
contains( fromJSON( '["pull_request_review", "pull_request_review_comment"]' ), github.event_name ) ||
( github.event_name == 'issue_comment' && github.event.issue.pull_request ) ||
github.event_name == 'pull_request_target' && github.event.action != 'labeled' ||
github.event_name == 'pull_request_target' && github.event.action != 'labeled' && ! github.pull_request.draft && github.pull_request.state == 'open' ||
'props-bot' == github.event.label.name
steps:
Expand Down

0 comments on commit 87689b3

Please sign in to comment.