Make WordPress Core


Ignore:
Timestamp:
02/02/2024 04:35:59 PM (7 months ago)
Author:
desrosj
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/props-bot.yml

    r57517 r57523  
    22
    33on:
    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/.
     
    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.
     
    2021    type:
    2122      - created
    22       - deleted
    2323  # This event will run everytime a new PR review is initially submitted.
    2424  pull_request_review:
     
    2929    types:
    3030      - created
    31       - deleted
    3231
    3332# Cancels all previous workflow runs for pull requests that have not completed.
     
    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:
Note: See TracChangeset for help on using the changeset viewer.