mvasigh / dispatch-action

Github Action for triggering other workflows via message passing
MIT License
57 stars 9 forks source link

Cannot read property 'name' of undefined #10

Closed rishubil closed 3 years ago

rishubil commented 3 years ago

I tried to use this action in my project has encountered the following error:

Run mvasigh/dispatch-action@main
  with:
    token: ***
    event_type: update-original-translation
    repo: @
    debug: 0
TypeError: Cannot read property 'name' of undefined
    at exports.getDispatchDest (/home/runner/work/_actions/mvasigh/dispatch-action/main/dist/index.js:7725:37)
    at main (/home/runner/work/_actions/mvasigh/dispatch-action/main/dist/index.js:9192:35)
    at Object.676 (/home/runner/work/_actions/mvasigh/dispatch-action/main/dist/index.js:9233:9)
    at __webpack_require__ (/home/runner/work/_actions/mvasigh/dispatch-action/main/dist/index.js:20:41)
    at startup (/home/runner/work/_actions/mvasigh/dispatch-action/main/dist/index.js:38:21)
    at /home/runner/work/_actions/mvasigh/dispatch-action/main/dist/index.js:42:28
    at Object.<anonymous> (/home/runner/work/_actions/mvasigh/dispatch-action/main/dist/index.js:44:3)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
##[error]Cannot read property 'name' of undefined

And this is my workflow file

https://github.com/yf-dev/majsoul-plus-korean/blob/master/.github/workflows/update_original_translation.yml

mvasigh commented 3 years ago

Thanks for opening this issue @rishubil

This should be a relatively straightforward fix; I'll work on it today!

rishubil commented 3 years ago

I'm not trying to rush you, but is there any work going on on this issue? If it takes some time, can you give me a temporary solution to the problem?

mvasigh commented 3 years ago

I'm not trying to rush you, but is there any work going on on this issue? If it takes some time, can you give me a temporary solution to the problem?

Sorry for the delay; I lost track of this. The workaround that should work is that you can specify a repository name in your workflow file for the action, like so:

      - name: Emit repository_dispatch
        uses: mvasigh/dispatch-action@main
        with:
          token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
          event_type: update-original-translation
          repo: majsoul-plus-korean
          owner: yf-dev

This should do the trick! I think it looks like GitHub may have changed some of their context payloads causing this error to pop up now.

rishubil commented 3 years ago

I just applied the method you said. Thank you!

mvasigh commented 3 years ago

I just applied the method you said. Thank you!

Np, let me know if you encounter other issues!