Locietta / xanmod-kernel-WSL2

Xanmod kernel for WSL2, built by clang with ThinLTO enabled. Build & Release are automated by Github Action.
GNU General Public License v2.0
85 stars 20 forks source link

Release failed: Cannot read property 'data' of undefined #10

Closed Locietta closed 2 years ago

Locietta commented 2 years ago

release somehow failed with

Error: Cannot read property 'data' of undefined

The issue is already at softprops/action-gh-release#221. Seems like just a re-run could fix this failure🤔

Locietta commented 2 years ago

Seems like just a re-run could fix this failure🤔

Partial rerun of release job in the workflow doesn't work though, maybe a thorough rerun can help? Anyway, it looks like an internal TypeScript Error in the release action...

Locietta commented 2 years ago

Partial rerun of release job in the workflow doesn't work though, maybe a thorough rerun can help?

No luck...

Locietta commented 2 years ago

So it's probably not my mistake in build.yml, since reverting back to the last successful release doesn't change the situation. Still don't know what happens.

Locietta commented 2 years ago

Going to see if changing the version of release action works.

Locietta commented 2 years ago

can't reproduce with minimal .yml file at here

Locietta commented 2 years ago

Get a minimal reproduce: when you don't have requested tag but enable the auto-generated release notes with broken release.yml, we'll get the "can't read data of undefined" error.

when the tag already exists, the release action somehow will just upload assets without generating the error.

Locietta commented 2 years ago

Still keep failing even with the correct release.yml🤔 At least we can confirm auto-generating release notes is the trouble-maker.

Locietta commented 2 years ago

Finally solve the problem🎉

For some notes: Cannot read property 'data' of undefined is caused by my broken release.yml, and the reason why fix in PR didn't work is that the release action, by default, creates releases on main branch, where the release.yml is still broken.

Solution is easy: set target_commitish to commit sha of current branch.

But be careful as ${{ github.sha }} will return sha of the merge commit in a PR, not the latest commit we push. That's a bit tricky, so you may want something like:

    - id: fetch_commit_sha
      run: |
        if [ ${{ github.event_name == 'pull_request' }} ]; then
          echo "::set-output name=sha::${{ github.event.pull_request.head.sha }}"
        else 
          echo "::set-output name=sha::${{ github.sha }}"
        fi
    - name: Release
      uses: softprops/action-gh-release@v1
      with:
        target_commitish: ${{ steps.fetch_commit_sha.outputs.sha }} 
        ......