Hello everyone!

As part of the migration of the precommit and postcommit jobs from jenkins
over to github actions, we're trying to implement the *trigger phrase*
functionality.
Our first approach was to use issue_comment
<https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issue_comment>
One problem we noticed after testing is that it looks like issue_comment is
mutually exclusive with the other events. For example, given the following
flow

name: Java Tests
on:
  schedule:
    - cron: '10 2 * * *'
  push:
    branches: ['master', 'release-*']
  pull_request:
    branches: ['master', 'release-*']
    paths: ['sdks/java/**', 'model/**', 'runners/**', 'examples/java/**',
            'examples/kotlin/**', 'release/**', 'buildSrc/**']
  issue_comment:
  types: [created]

jobs:
  pr_commented:
      # This job only runs for pull request comments
      name: PR comment
        if: ${{ github.event.issue.pull_request }}
    runs-on: ubuntu-latest
    steps:
       - run: |
              echo A comment on PR $NUMBER
        env:
           NUMBER: ${{ github.event.issue.number }}

  issue_commented:
    # This job only runs for issue comments
    name: Issue comment
    if: ${{ !github.event.issue.pull_request }}
    runs-on: ubuntu-latest
    steps:
      - run: |
          echo A comment on issue $NUMBER
        env:
          NUMBER: ${{ github.event.issue.number }}

the flow will get kicked off but upon validating the if conditional,
neither job will run since the github.event.issue.pull_request parameter is
not present.

Another caveat is that we'd have to populate with an if statement every job
we wanted to execute by way of a trigger phrase.

Does someone have experience with this kind of work? Has someone
implemented trigger phrases in github actions?

Thanks!

-- 
*This email and its contents (including any attachments) are being sent to
you on the condition of confidentiality and may be protected by legal
privilege. Access to this email by anyone other than the intended recipient
is unauthorized. If you are not the intended recipient, please immediately
notify the sender by replying to this message and delete the material
immediately from your system. Any further use, dissemination, distribution
or reproduction of this email is strictly prohibited. Further, no
representation is made with respect to any content contained in this email.*

Reply via email to