lots0logs / gh-action-get-changed-files

GitHub Action that saves changed files as JSON for use by other actions.
MIT License
86 stars 38 forks source link

TypeError: Cannot read property 'filter' of undefined #8

Closed Poolitzer closed 4 years ago

Poolitzer commented 4 years ago

Hey guys,

seems to be the same error as in #2, just a different file.

/home/runner/work/_actions/lots0logs/gh-action-get-changed-files/2.0.6/dist/main.js:3567
const commits = context.payload.commits.filter(c => c.distinct);
                                        ^

TypeError: Cannot read property 'filter' of undefined

Full runthrough with error (just trying your action out here ;P): https://github.com/python-telegram-bot/python-telegram-bot/pull/1786/checks?check_run_id=459027793#step:6:1

Your action is implemented here, should be correct.

grantmcconnaughey commented 4 years ago

I got this same error as well when attempting to use this Action with version 2.0.6.

ndibari-etsy commented 4 years ago

Hi is there any update on this? Also got the same error on version 2.0.6. Is there a version that does work in the meantime that we can use?

lots0logs commented 4 years ago

Sorry for not noticing this issue before now. I can confirm that v2.0.5 works without issue so long as its used on repos owned by an organization. Not sure when I will have time to look into this new error but I will do it asap.

sgibson91 commented 4 years ago

I hate to be the bearer of bad new but I am also seeing this error with v2.0.5 😬

... so long as its used on repos owned by an organization.

Can you explain what you mean by this please? This is the repo I'm working on, definitely owned by an org https://github.com/alan-turing-institute/the-turing-way

Poolitzer commented 4 years ago

Maybe he meant PRs from inside the organization

sgibson91 commented 4 years ago

Hi @Poolitzer! I've branched, not forked, and I'm a member of that org ☺️

Poolitzer commented 4 years ago

Destroying my theories in an instant, pfff :(

lots0logs commented 4 years ago

What I meant by that was that the repo is owned by an org account and not a personal user account. We are using v2.0.5 without issue at the company I work for.

Poolitzer commented 4 years ago

My PR situation is also owned by a company/collective

lots0logs commented 4 years ago

I'll have to dig deeper into this. Not sure off hand what is causing the failure.

serucee commented 4 years ago

Hi,

this happens when the action is used in a pull request (atleast for me) and is resolved when using it on push. I assume the payload used in https://github.com/lots0logs/gh-action-get-changed-files/blob/master/main.js#L6 isn't available in the same way for pull requests.

lots0logs commented 4 years ago

Thanks. That is helpful!

ThiefMaster commented 4 years ago

Happens for me as well and makes this action useless for me - which is a shame, because it's the only action to get a list of changed files that actually looks decent.

lots0logs commented 4 years ago

I'm happy to review a pull request from anyone who has the time to add support for events other than push. I just don't have time right now. Especially since we only use this action on the push event at my job so it works fine.

adamjstewart commented 4 years ago

I encountered the same problem, this action does not work for pull requests. For what it's worth, https://github.com/marketplace/actions/file-changes-action has almost identical functionality and works fine for me on pull requests.