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

Error: Cannot read properties of undefined (reading 'number') #323

Closed
fingolfin opened this issue Mar 13, 2024 · 3 comments
Closed

Error: Cannot read properties of undefined (reading 'number') #323

fingolfin opened this issue Mar 13, 2024 · 3 comments

Comments

@fingolfin
Copy link

fingolfin commented Mar 13, 2024

We are using this wonderful GH action to create PR comment -- but also very often to update PR comments (see https://github.com/gap-system/PackageDistro/blob/main/.github/workflows/pull-request.yml for our full YAML file):

      - name: "Create or update comment"
        uses: peter-evans/create-or-update-comment@v4   
        with:
          token: ${{ steps.generate-token.outputs.token }}
          comment-id: ${{ steps.fc.outputs.comment-id }}
          issue-number: ${{ github.event.pull_request.number }}
          body: ${{ steps.get-comment-body.outputs.body }}
          edit-mode: replace

Today this workflow suddenly had failures I never saw before (although I should say we had been using v2 until 19 February 2024), when it tried to update an existing PR (actually the update in this case would be identical to the existing PR, which so far worked perfectly -- it just did nothing).

There error (see here for full log):

Create or update the pull request
  Attempting creation of pull request
  A pull request already exists for gap-system:automatic/cap_project
  Fetching existing pull request
  Attempting update of pull request
  Error: Cannot read properties of undefined (reading 'number')
@fingolfin
Copy link
Author

I am terribly sorry -- while writing this up I got my wires crossed and looked at the wrong action. The issue really is with peter-evans/create-pull-request@v4. I'll open a new one there.

Apologies for the confusion

@peter-evans
Copy link
Owner

Hi @fingolfin

You're right, this does relate to create-pull-request. There is already an issue about this here: peter-evans/create-pull-request#2790

The issue was caused by GitHub making a change to one of their APIs. You can fix it by updating to v6.

@fingolfin
Copy link
Author

Thanks a lot, that did the trick!

And thanks for maintaining these actions, very much appreciated.

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

No branches or pull requests

2 participants