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

Workflow run fails when triggered by an issue_comment event #69

Closed
andylolz opened this issue Jun 17, 2021 · 6 comments · Fixed by #72
Closed

Workflow run fails when triggered by an issue_comment event #69

andylolz opened this issue Jun 17, 2021 · 6 comments · Fixed by #72

Comments

@andylolz
Copy link

andylolz commented Jun 17, 2021

My workflow looks like this:

name: This fails
on:
  issue_comment:
    types:
      - created
jobs:
  mark-as-updated:
    steps:
      - uses: alex-page/[email protected]
        with:
          project: Project name
          column: Column name
          repo-token: ${{ secrets.TOKEN }}

It fails with the following error message:

Error: Cannot read property 'projects' of undefined

If I instead trigger it using e.g.:

on:
  issues:
    types:
      - opened

…it works fine.

I’m not exactly sure, but I wonder if the problem is this line:

... on ${eventName === 'issues' ? 'Issue' : 'PullRequest'} {

@MrDogeBro
Copy link
Contributor

Same issue here but I dont know if thats the line that is causing the problem.

@andylolz
Copy link
Author

I thought it was that line because the event name in this case is issue_comment, but that line means it’s treated like a pull request event.

Maybe something like this?

... on ${eventName.startsWith('issue') ? 'Issue' : 'PullRequest'} { 

(Though I haven’t looked into it, and I’m guessing a bit here.)

@alex-page
Copy link
Owner

Happy to accept a pull request. That definitely looks like it would be a problem with eventName.

@MrDogeBro
Copy link
Contributor

I have done a little testing and it is something within that function. Just gotta do some more testing to figure out what exactly is the problem.

@MrDogeBro
Copy link
Contributor

I thought it was that line because the event name in this case is issue_comment, but that line means it’s treated like a pull request event.

Maybe something like this?

... on ${eventName.startsWith('issue') ? 'Issue' : 'PullRequest'} { 

(Though I haven’t looked into it, and I’m guessing a bit here.)

Ahh I see -- that would probably make sense. I'll try that solution and see what happens.

@MrDogeBro
Copy link
Contributor

Ok I have just tested and that solution seems to work! I will make a PR with the changes!

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

Successfully merging a pull request may close this issue.

3 participants