Skip to content

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

Closed

Description

@AllDmeat

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 }}

Activity

  1. peter-evans commented on Sep 12, 2024

    @peter-evans
    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.

  2. peter-evans commented on Sep 12, 2024

    @peter-evans
    Owner

    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.

  3. peter-evans commented on Sep 12, 2024

    @peter-evans
    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.

  4. added a commit that references this issue on Sep 15, 2024
  5. AnnAngela commented on Sep 15, 2024

    @AnnAngela

    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

  6. luong-komorebi commented on Sep 16, 2024

    @luong-komorebi

    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> 
    
  7. peter-evans commented on Sep 16, 2024

    @peter-evans
    Owner

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

  8. peter-evans commented on Sep 16, 2024

    @peter-evans
    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.

  9. luong-komorebi commented on Sep 16, 2024

    @luong-komorebi

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

  10. AllDmeat commented on Sep 17, 2024

    @AllDmeat
    Author

    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.

  11. AnnAngela commented on Sep 22, 2024

    @AnnAngela

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions