Skip to content

[error]Cannot read property 'author' of undefined #2

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

Closed
Andre601 opened this issue Jan 2, 2020 · 7 comments
Closed

[error]Cannot read property 'author' of undefined #2

Andre601 opened this issue Jan 2, 2020 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@Andre601
Copy link

Andre601 commented Jan 2, 2020

When executing the job below, does the workflow fail with this error.

##[error]Cannot read property 'author' of undefined
##[error]Node run failed with exit code 1

Workflow:

name: Publication task

on:
  release:
    types: [published]
    branches:
    - master

jobs:
  publish:
    # Unrelated task that runs successfully, allowing below task to start.
  sendMessage:
    needs: [publish]
    if: success()
    runs-on: ubuntu-latest
    steps:
    - name: Discord notification
      uses: rjstone/[email protected]
      with:
        webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
        severity: info
        avatarUrl: 'https://raw.githubusercontent.com/botblock/JavaBotBlockAPI/master/src/main/resources/jbba.png'
        username: New release (${{ github.event.release.tag_name }})
        text: ${{ github.event.release.name }}
        description: '**Release Information**'
        details: '${{ github.event.release.body }}'
@Andre601 Andre601 changed the title [error [error]Cannot read property 'author' of undefined Jan 2, 2020
@rjstone
Copy link
Owner

rjstone commented Jan 3, 2020

This is because the default message doesn't properly handle all event types, which don't define all of the json properties that are expected. I've been meaning to create different defaults for different event types so I'll go ahead and do that which should fix it.

@rjstone rjstone self-assigned this Jan 3, 2020
@rjstone rjstone added the bug Something isn't working label Jan 3, 2020
@rjstone
Copy link
Owner

rjstone commented Jan 3, 2020

Ok, give v1 a try again. The head of the v1 branch has what should be a fix.

Here's a list of all the possible event types and their JSON info: https://developer.github.com/v3/activity/events/types/

If anyone wants to contribute new defaults for each event type then just send me a pull request. There's a function that returns the default descriptions so it's pretty obvious how to do it.

@Andre601
Copy link
Author

Andre601 commented Jan 3, 2020

So I can stick with rjstone/[email protected] or would I need to change the version?

@rjstone
Copy link
Owner

rjstone commented Jan 3, 2020

Change version to just @v1. If it is working I will tag it with v1.0.3

@Andre601
Copy link
Author

Andre601 commented Jan 3, 2020

Worked flawlessly.
image

@Andre601 Andre601 closed this as completed Jan 3, 2020
@rjstone
Copy link
Owner

rjstone commented Jan 4, 2020

Ok, tagged v1.0.4

@yskorge
Copy link

yskorge commented Jul 13, 2022

Seems like v1 of rjstone/discord-webhook-notify@v1 is throwing and Error Cannot read property 'full_name' of undefined.

Workflow code:

- name: Test Success EX Manager
        uses: rjstone/discord-webhook-notify@v1
        if: success()
        with:
          severity: info
          details: EX Manager test SUCCEEDED! :-)
          webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants