Action: pull_request/labeled not triggered when actions/labeler@v3 added label

name: On label added in PR

on:
  pull_request:
    types: [ labeled ]

jobs:
  notifyInSlack:
    runs-on: ubuntu-latest

    steps:
      - name: debug info
        uses: hmarr/debug-action@v2

this workflow is not triggered when actions/labeler@v3 added label

the labeler workflow:

name: "Pull Request Labeler"

on:
  - pull_request_target

jobs:
  sync:
    runs-on: self-hosted
    steps:
      - uses: actions/labeler@v3
        with:
          repo-token: "${{ secrets.GITHUB_TOKEN }}"

As a general rule, github actions will not trigger other github workflows:

If you want it to work, you need to use a Personal Access Token instead of the default GITHUB_TOKEN.

used script to check the label (runtime) and then do slack messaging after it

name: "Pull Request Labeler"

on:
  - pull_request_target

jobs:
  sync:
    runs-on: self-hosted
    steps:
      - uses: actions/labeler@v3
        with:
          repo-token: "${{ secrets.GITHUB_TOKEN }}"
      - name: Sleep for 5 seconds
        run: sleep 5s
        shell: bash
      - name: View context attributes
        uses: actions/github-script@v5
        with:
          script: console.log(JSON.stringify(context,0,4))
      - name: check label and return what slack channel should send
        uses: actions/github-script@v5
        id: get-channel
        with:
          result-encoding: string
          script: |
            let info = await github.rest.pulls.get({
              owner:context.payload.repository.owner.login,
              repo:context.payload.repository.name,
              pull_number:context.payload.number,
            });
            console.log(info);
            console.log(JSON.stringify(info,0,4));
            if(info.data.labels.map(a=>a.name).filter((name) => /label\-name/i.test(name)).length>0){
              return 'test-for-alert'
            }
            return ''
      - name: Slack Notification for telematics
        uses: rtCamp/action-slack-notify@v2
        if: ${{ steps.get-channel.outputs.result != ''}}
        env:
          SLACK_CHANNEL: ${{steps.get-channel.outputs.result}}
          SLACK_COLOR: success # or a specific color like 'green' or '#ff00ff'
          SLACK_TITLE: "${{ github.event.pull_request.title }}"
          SLACK_MESSAGE: "PR created, url:\n${{ github.event.pull_request.html_url }}"
          SLACK_USERNAME: New PR Bot
          SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
          SLACK_FOOTER: ''
          MSG_MINIMAL: true
1 Like