Skip to content

Commit e9e2281

Browse files
committed
Build/Test Tools: Some improvements to the Props Bot workflow.
This makes a few improvements made to the Props Bot workflow: - The bot will no longer run on draft PRs. - The bot will no longer run on closed PRs. - The bot will no longer run when a comment is deleted (this should almost never happen). Props mamaduka, gziolo. See #60417. git-svn-id: https://develop.svn.wordpress.org/trunk@57523 602fd350-edb4-49c9-b593-d223f7449a82
1 parent b645284 commit e9e2281

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

.github/workflows/props-bot.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Props Bot
22

33
on:
4-
# This event runs anytime a PR is (re)opened, updated, or labeled.
4+
# This event runs anytime a PR is (re)opened, updated, marked ready for review, or labeled.
55
# GitHub does not allow filtering the `labeled` event by a specific label.
66
# However, the logic below will short-circuit the workflow when the `props-bot` label is not the one being added.
7-
# Note: The pull_request_target event is uesed instead of pull_request because this workflow needs permission to comment
7+
# Note: The pull_request_target event is used instead of pull_request because this workflow needs permission to comment
88
# on the pull request. Because this event grants extra permissions to `GITHUB_TOKEN`, any code changes within the PR
99
# should be considered untrusted. See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/.
1010
pull_request_target:
@@ -13,13 +13,13 @@ on:
1313
- synchronize
1414
- reopened
1515
- labeled
16+
- ready_for_review
1617
# This event runs anytime a comment is added or deleted.
1718
# You cannot filter this event for PR comments only.
1819
# However, the logic below does short-circuit the workflow for issues.
1920
issue_comment:
2021
type:
2122
- created
22-
- deleted
2323
# This event will run everytime a new PR review is initially submitted.
2424
pull_request_review:
2525
types:
@@ -28,7 +28,6 @@ on:
2828
pull_request_review_comment:
2929
types:
3030
- created
31-
- deleted
3231

3332
# Cancels all previous workflow runs for pull requests that have not completed.
3433
concurrency:
@@ -55,17 +54,20 @@ jobs:
5554
pull-requests: write
5655
contents: read
5756
timeout-minutes: 20
58-
# The job should only run if:
57+
# The job will run when pull requests are open, ready for review and:
5958
#
60-
# - A pull request review is created or commented on.
61-
# - An issue comment is added to a pull request.
62-
# - A pull request is opened, synchronized, or reopened.
59+
# - A comment is added to the pull request.
60+
# - A review is created or commented on.
61+
# - The pull request is opened, synchronized, marked ready for review, or reopened.
6362
# - The `props-bot` label is added to the pull request.
6463
if: |
65-
contains( fromJSON( '["pull_request_review", "pull_request_review_comment"]' ), github.event_name ) ||
66-
( github.event_name == 'issue_comment' && github.event.issue.pull_request ) ||
67-
github.event_name == 'pull_request_target' && github.event.action != 'labeled' ||
68-
'props-bot' == github.event.label.name
64+
(
65+
github.event_name == 'issue_comment' && github.event.issue.pull_request ||
66+
contains( fromJSON( '["pull_request_review", "pull_request_review_comment"]' ), github.event_name ) ||
67+
github.event_name == 'pull_request_target' && github.event.action != 'labeled' ||
68+
'props-bot' == github.event.label.name
69+
) &&
70+
( ! github.event.pull_request.draft && github.event.pull_request.state == 'open' || ! github.event.issue.draft && github.event.issue.state == 'open' )
6971
7072
steps:
7173
- name: Gather a list of contributors

0 commit comments

Comments
 (0)