Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editing PR first comment or title does not trigger a workflow #27

Closed
eine opened this issue Sep 16, 2019 · 10 comments
Closed

Editing PR first comment or title does not trigger a workflow #27

eine opened this issue Sep 16, 2019 · 10 comments

Comments

@eine
Copy link

eine commented Sep 16, 2019

I'm trying to write an action based on this template that will check/watch the first comment of PRs. Each time the comment is edited/updated, the workflow should be executed. I tried with the following workflow:

name: 'Self-labelling'
on: [pull_request, issues, issue_comment]
jobs:
  build:
    strategy:
      fail-fast: false
    runs-on: ubuntu-latest
    steps:
    - uses: 1138-4EB/actions@tip

I found that it is executed when I open a PR, respond to a PR (new comment), open an issue, respond to an issue, edit the body of the first comment of an issue, etc. However, it does not work neither when editing the first comment of a PR nor when editing the title of a PR. Therefore, it seems that the only option to trigger the workflow after the PR is created is to synchronize it again. I would expect that any of these actions would trigger pull_request edited, issue_comment edited or issues edited.

/cc @damccorm

@ibrasho
Copy link

ibrasho commented Sep 18, 2019

This is expected. By default, the pull_request event only triggers on these actions: opened, synchronize and reopened reference.

You need to do the following:

on:
  pull_request:
    types: edited
  issues:
  issue_comment:

@bryanmacfarlane
Copy link
Member

Thanks @ibrasho

@AllanOricil
Copy link

I need to reopen this. I just edited my title and it is no longer triggering my action.

name: Bump Version Workflow

on:
  pull_request:
    types: [opened, synchronize, edited, ready_for_review]
    branches:
      - main

  workflow_dispatch:

jobs:
  get-mulesoft-apps:
    name: Get Mulesoft Apps
    uses: VodafoneIS/mulesoft/.github/workflows/get-mulesoft-apps.yml@main

  bump-version:
    name: bump version
    needs: get-mulesoft-apps
    runs-on: ubuntu-latest
    container:
      image: ghcr.io/vodafoneis/mulesoft-build-image:main
      credentials:
        username: ${{ github.actor }}
        password: ${{ secrets.GITHUB_TOKEN }}

    strategy:
      matrix:
        MULESOFT_APP: ${{ fromJson(needs.get-mulesoft-apps.outputs.MULESOFT_APPS) }}

    defaults:
      run:
        working-directory: ${{ matrix.MULESOFT_APP }}

    steps:
      - uses: actions/checkout@v2
        with:
          ref: ${{ github.event.pull_request.head.ref }}

      - name: print app name
        run: echo ${{ matrix.MULESOFT_APP }}

      - uses: fregante/setup-git-user@v1

      - name: set bump type
        id: get-bump-type
        run: |
          bump_type=$(/scripts/get_bump_type.sh -a ${{ matrix.MULESOFT_APP }} -t ${{ github.event.pull_request.title }} -b ${{ github.event.pull_request.body}})
          echo "::set-output name=BUMP_TYPE::$bump_type"

      - name: bump version
        run: /scripts/bump_version.sh -a ${{ matrix.MULESOFT_APP }} -b ${{ steps.get-bump-type.outputs.BUMP_TYPE }}

@AllanOricil
Copy link

What happened?

Screenshot 2021-12-09 at 17 21 20

Screenshot 2021-12-09 at 17 21 39

@obryckim
Copy link

@AllanOricil - Did you ever resolve this? I am seeing the same behavior where the edited event is not triggering the workflow, even with

on:
  pull_request:
    types:
      - opened
      - edited
      - reopened
      - synchronize

@AllanOricil
Copy link

AllanOricil commented Jan 27, 2024

@AllanOricil - Did you ever resolve this? I am seeing the same behavior where the edited event is not triggering the workflow, even with

on:
  pull_request:
    types:
      - opened
      - edited
      - reopened
      - synchronize

@obryckim
It never worked for me. I created another workflow that was triggered using a PR comment. User edits PR title, nothing happens. Then he comments something in the PR to trigger what should have happened.

I also realized I was solving the problem of bumping version in a very weird/unusual way. Looking at it now, I'm kind ashamed haha

@obryckim
Copy link

@AllanOricil

So, interesting update. When I have the workflow directly in a repository, with the pull_request setup as specified above, it works. I can edit the PR title (of the PR in that repo) and the workflow runs (all other trigger events specified work as well).

Now, I have an organization ruleset setup where the only rule is that this workflow must pass before merging. No big deal. I am targeting 1 specific repo (for now) and all is good.

  • When I create a PR in that repo, this workflow runs (opened)
  • When I close and then reopen the PR, the workflow runs (reopened)
  • When I push new code, the workflow runs (synchronize)
  • Yet, when I edit the PR (title, desc, etc.), the workflow does not run (edited)
    • This is what is really confusing me. Since when dropping the workflow directly in a repository, the edited event triggers the workflow; but when the workflow is in a org ruleset, all of the triggers work except edited.
    • This wouldn't really be a big deal, but I have over 80 repos and need this workflow to run in all of them. The org-level ruleset is definitely the way to go here; but that one event isn't firing.

image

@AllanOricil
Copy link

@AllanOricil

So, interesting update. When I have the workflow directly in a repository, with the pull_request setup as specified above, it works. I can edit the PR title (of the PR in that repo) and the workflow runs (all other trigger events specified work as well).

Now, I have an organization ruleset setup where the only rule is that this workflow must pass before merging. No big deal. I am targeting 1 specific repo (for now) and all is good.

  • When I create a PR in that repo, this workflow runs (opened)
  • When I close and then reopen the PR, the workflow runs (reopened)
  • When I push new code, the workflow runs (synchronize)
  • Yet, when I edit the PR (title, desc, etc.), the workflow does not run (edited)
    • This is what is really confusing me. Since when dropping the workflow directly in a repository, the edited event triggers the workflow; but when the workflow is in a org ruleset, all of the triggers work except edited.
    • This wouldn't really be a big deal, but I have over 80 repos and need this workflow to run in all of them. The org-level ruleset is definitely the way to go here; but that one event isn't firing.

image

@obryckim if u really need to run this workflow, I think you can change on pull_request.edited by repository_dispatch or workflow_dispatcg, and then run it through api or manually

@efemoney
Copy link

Have the same issue as @obryckim. Why is this issue still closed 🤔

@justas200
Copy link

Same issue 😠

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants