create-or-update-pull-request-action icon indicating copy to clipboard operation
create-or-update-pull-request-action copied to clipboard

Cannot destructure property `hasChanges`

Open FabioRosado opened this issue 5 years ago • 4 comments

Hello,

Thank you for creating this action, I'm using github actions for the first time so I guess there is a lot I don't understand.

I'm trying to create an action that runs black linting to a python project.

This is my actions file

name: lint

on: 
  - push
  - pull_request

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
      - uses: rocioar/gradual-black-formatter@v1
      - uses: gr2m/[email protected]
        env: 
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }

But when commit a change/open a PR, this action fails with:

Run gr2m/[email protected]
##[error]Cannot destructure property `hasChanges` of 'undefined' or 'null'.

Any idea what I am doing wrong or did I found a bug?

Thank you for you time.

FabioRosado avatar Sep 14 '20 14:09 FabioRosado

Hmm first time I see that error. It must be originating from this code

https://github.com/gr2m/create-or-update-pull-request-action/blob/6f066da31e30fac4c3dc5a66281928ced0435a9f/index.js#L61

The getLocalChanges method is here:

https://github.com/gr2m/create-or-update-pull-request-action/blob/6f066da31e30fac4c3dc5a66281928ced0435a9f/index.js#L163-L178

The result of await getLocalChanges(inputs.path) should always be an object ... 🤔

Can you share the full error stack please?

gr2m avatar Sep 14 '20 15:09 gr2m

What would be the best way to do this? That error I've received from running the action so not sure how to do it sorry 😬

FabioRosado avatar Sep 14 '20 19:09 FabioRosado

Is your repository public?

The best way to help would be to create a new minimal repository, reproduce the steps to get to the state where the above error is thrown, document the steps so I can reproduce it myself. You could invite me to that repository too, then I can add some debugging steps myself

gr2m avatar Sep 14 '20 19:09 gr2m

Hello,

thank you for the quick reply. I created a testing repo for github actions - GitHub action Test Repo

You can probably see the action that failed on the couple pushes and PR that I tried to raise. Hope this helps

FabioRosado avatar Sep 16 '20 19:09 FabioRosado