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 destructure property 'path' of 'undefined' as it is undefined #3329

Closed
AllDmeat opened this issue Sep 12, 2024 · 10 comments
Closed

Cannot destructure property 'path' of 'undefined' as it is undefined #3329

AllDmeat opened this issue Sep 12, 2024 · 10 comments

Comments

@AllDmeat
Copy link

Subject of the issue

Update from v6 to v7 broke branches autosync: Keep a branch up-to-date with another

Logs:

/usr/bin/git branch --delete --force 01e9c082-9f8a-484e-ae64-71f88826f179
Deleted branch 01e9c082-9f8a-484e-ae64-71f88826f179 (was bc810dcf65).
/usr/bin/git checkout --progress develop --
Switched to branch 'develop'
Your branch is up to date with 'origin/develop'.
Pushing pull request branch to 'origin/sync/release/10.17.0-into-develop'
/usr/bin/git stash push --include-untracked
No local changes to save
/usr/bin/git checkout --progress sync/release/10.17.0-into-develop --
Switched to branch 'sync/release/10.17.0-into-develop'
Creating tree objects for local commit 148e4896bf968684c12e6ded7e35fb6c3c6fe478
Error: Cannot destructure property 'path' of 'undefined' as it is undefined.

Only changes I've made to step is:

  1. Updated to v7
  2. Renamed token into branch-token
  3. Enabled sign-commits

Steps to reproduce

Job with v6

This works just fine:

name: Release → Develop

on:
  push:
    branches:
      - 'release/**'
  workflow_dispatch:

jobs:
  merge-release-to-develop:
    runs-on: ubuntu-latest

    timeout-minutes: 3

    env:
      BRANCH_NAME: 'sync/${{ github.ref_name }}-into-develop'

    steps:
    - uses: actions/checkout@v4
      with:
        ref: develop
        fetch-depth: 0

    - uses: tibdex/github-app-token@v2
      id: generate-token
      with:
        app_id: ${{ secrets.APP_ID }}
        private_key: ${{ secrets.APP_PRIVATE_KEY }}

    - name: Reset promotion branch
      run: |
        git fetch origin ${{ github.ref_name }}:${{ github.ref_name }}
        git reset --hard ${{ github.ref_name }}

    - name: Create Pull Request
      id: cpr
      uses: peter-evans/create-pull-request@v6
      with:
        token: ${{ steps.generate-token.outputs.token }}
        base: 'develop'
        branch: '${{ env.BRANCH_NAME }}'
        title: '${{ github.ref_name }} → develop'

    - name: Enable automerge
      if: ${{ steps.cpr.outputs.pull-request-number }}
      env:
        GH_TOKEN: ${{ steps.generate-token.outputs.token }}
      run: gh pr merge --merge --auto ${{ steps.cpr.outputs.pull-request-number }}

Job with v7

This doesn't work:

name: Release → Develop

on:
  push:
    branches:
      - 'release/**'
  workflow_dispatch:

jobs:
  merge-release-to-develop:
    runs-on: ubuntu-latest

    timeout-minutes: 3

    env:
      BRANCH_NAME: 'sync/${{ github.ref_name }}-into-develop'

    steps:
    - uses: actions/checkout@v4
      with:
        ref: develop
        fetch-depth: 0

    - uses: tibdex/github-app-token@v2
      id: generate-token
      with:
        app_id: ${{ secrets.APP_ID }}
        private_key: ${{ secrets.APP_PRIVATE_KEY }}

    - name: Reset promotion branch
      run: |
        git fetch origin ${{ github.ref_name }}:${{ github.ref_name }}
        git reset --hard ${{ github.ref_name }}

    - name: Create Pull Request
      id: cpr
      uses: peter-evans/create-pull-request@v7
      with:
        branch-token: ${{ steps.generate-token.outputs.token }}
        sign-commits: true
        base: 'develop'
        branch: '${{ env.BRANCH_NAME }}'
        title: '${{ github.ref_name }} → develop'

    - name: Enable automerge
      if: ${{ steps.cpr.outputs.pull-request-number }}
      env:
        GH_TOKEN: ${{ steps.generate-token.outputs.token }}
      run: gh pr merge --merge --auto ${{ steps.cpr.outputs.pull-request-number }}
@peter-evans
Copy link
Owner

Hi @AllDmeat

Thanks for reporting. I'm fairly sure this will work as it did before if you disable sign-commits. I'll investigate this and see why the commit signing code path fails in this case.

@peter-evans
Copy link
Owner

peter-evans commented Sep 12, 2024

Are you able to provide the full log of the run? That would be very useful if you can.

Or, if there are log lines which say Skipping unexpected diff entry you can just provide those. I have a suspicion it could be related to that.

@peter-evans
Copy link
Owner

I've released a change in v7.0.2 / v7, which may fix it for you. Please try it and let me know.

If it doesn't fix the issue, please look for warning lines in the log which start with Skipping unexpected diff entry, and let me know the detail of the lines.

status102 referenced this issue in MaaAssistantArknights/MaaAssistantArknights Sep 15, 2024
@AnnAngela
Copy link

AnnAngela commented Sep 15, 2024

Hi, we had this very same issue, and this is the gha run entry: https://github.com/MaaAssistantArknights/MaaAssistantArknights/actions/runs/10869083828

There was a report about skipping unexpected diff entry:

Skipping unexpected diff entry: :100644 100644 cb971edb7 5a6d3aa95 M CHANGELOG.md

I believed that the run used v7.0.2 since it downloaded commit d121e62763d8cc35b5fb1710e887d6e69a52d3a4 which is the commit d121e62 marked as https://github.com/peter-evans/create-pull-request/releases/tag/v7.0.2

@luong-komorebi
Copy link

I am experiencing the same problem. Let me know which kind of information can be helpful for the debugging process of this

I did see warnings on almost all the changes that we had

  Warning: Skipping unexpected diff entry :100644 100644 ba113843 c941067a M   <some of our files> 
  Warning: Skipping unexpected diff entry :100644 100644 ba113843 c941067a M     <some of our files> 
  Warning: Skipping unexpected diff entry  :100644 100644 ba113843 c941067a M      <some of our files> 

@peter-evans
Copy link
Owner

@AnnAngela @luong-komorebi Thank you both for your reports. I've identified the issue and I have a fix ready to release.

@peter-evans
Copy link
Owner

@AnnAngela @luong-komorebi I've released v7.0.3 / v7 to fix the issue you both reported. Thank you! ✨

I'm still going to leave this issue open. The nature of this particular feature means that there could be other related issues that also cause the same error.

For anyone experiencing this error on v7.0.3 please look for warning lines in the log which start with Skipping unexpected diff entry, and let me know the detail of the lines.

@luong-komorebi
Copy link

I can confirm that this issue is now resolved. @peter-evans Thank you for your prompt support

@AllDmeat
Copy link
Author

AllDmeat commented Sep 17, 2024

Or, if there are log lines which say Skipping unexpected diff entry you can just provide those. I have a suspicion it could be related to that.

Sorry, missed your message. There were such logs.

Updating to 7.0.3 fixed issue for me. Thanks a lot.

@AnnAngela
Copy link

Updating to 7.0.3 fixed issue for us, like MaaAssistantArknights/MaaAssistantArknights@a69a45e (#10657). Thanks so much.

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

4 participants