Skip to content

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

Closed
@AllDmeat

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

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