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

Cannot read properties of undefined (reading 'number') #2790

Comments

@stevelacey
Copy link

Subject of the issue

I started getting this error on v4, so upgraded to v6, but I'm still seeing it 🤔

Create or update the pull request
  Attempting creation of pull request
  A pull request already exists for example:branch
  Fetching existing pull request
  Attempting update of pull request
  Error: Cannot read properties of undefined (reading 'number')

Seems to only happen when there's an existing pull request, if I delete the existing one the workflow will succeed.

Steps to reproduce

Run the workflow with an existing pull request present.

    - uses: peter-evans/create-pull-request@v6
      with:
        title: Release ${{ inputs.next_version }}
        body: |
          ## Release [${{ inputs.next_version }}](${{ github.server_url }}/${{ github.repository }}/compare/${{ inputs.previous_version }}...${{ steps.commit.outputs.short }})

          ${{ inputs.notes }}
        author: GitHub <[email protected]>
        branch: release
        committer: GitHub <[email protected]>
        commit-message: |
          chore(release): ${{ inputs.next_version }}
        delete-branch: true

https://github.com/stevelacey/release-builder/blob/v1/pull-request/action.yml#L27C25-L39

@walterholohan
Copy link

Same here, starting happening a few hours ago

@peter-evans
Copy link
Owner

I've not made any changes to the action since releasing v6, so this looks like an issue with GitHub's API.

Reproduced the problem with my test suite.
https://github.com/peter-evans/create-pull-request-tests/actions/runs/8071848530

I'll make a GitHub support ticket.

@peter-evans
Copy link
Owner

Created a GitHub support ticket for this issue. Thanks for reporting it.

@peter-evans
Copy link
Owner

I'm trying to confirm with GitHub support, but it looks like there was a bug with GitHub's list pull requests API that just got fixed. It appears I was unknowingly working around this bug for about 2 years! In fixing it they've caused a breaking change.

@peter-evans
Copy link
Owner

Released v6.0.1 / v6.

Please note that I'm assuming that GitHub are not going to roll this change back. 😓 I'm trying to confirm with GitHub support that it was actually a long standing bug that just got fixed.

@peter-evans peter-evans pinned this issue Feb 28, 2024
johnnyomair added a commit to vivid-planet/comet that referenced this issue Feb 28, 2024
Need an update to create-pull-request@v6 to fix [an issue with the GitHub API](peter-evans/create-pull-request#2790).
johnnyomair added a commit to vivid-planet/comet that referenced this issue Feb 28, 2024
Need an update to create-pull-request@v6 to fix [an issue with the
GitHub
API](peter-evans/create-pull-request#2790).
@peter-evans
Copy link
Owner

GitHub support have confirmed that an intentional change was made to the list API, and the fix they suggested to me (released as v6.0.1 / v6) should be good from now on. Not expecting this change to be rolled back.

na4zagin3 added a commit to na4zagin3/satyrographos-repo that referenced this issue Mar 14, 2024
peter-evans/create-pull-request v6 supports the upstream change peter-evans/create-pull-request#2790
na4zagin3 added a commit to na4zagin3/satyrographos-repo that referenced this issue Mar 14, 2024
peter-evans/create-pull-request v6 supports the upstream change peter-evans/create-pull-request#2790
AiroPi added a commit to mybot-organization/mybot that referenced this issue Mar 16, 2024
This fix a [bug](peter-evans/create-pull-request#2790) that occurs on PR creation when the "same" pull request already exist.
@peter-evans
Copy link
Owner

peter-evans commented Mar 20, 2024

Due to another issue preventing some users from being able to use v6, this fix is now backported to v5 in v5.0.3.

mergify bot pushed a commit to cdk8s-team/cdk8s-projen-common that referenced this issue Apr 15, 2024
Apparently following #704, projen stopped getting upgrades. We missed a fairly important update that bumps github action versions and fixes peter-evans/create-pull-request#2790
markmc added a commit to markmc/scouts-ie-training-schedule that referenced this issue Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment