changesets/action

TypeError: Cannot read properties of null (reading 'author')

jonathanlinat opened this issue ยท 1 comments

Hey. I am facing an issue when I try to version my packages. Here is the related GitHub Actions log.

image

Run changesets/action@v1
  
setting git user
/usr/bin/git config user.name "github-actions[bot]"
/usr/bin/git config user.email "github-actions[bot]@users.noreply.github.com"
setting GitHub credentials
/usr/bin/git checkout changeset-release/main
error: pathspec 'changeset-release/main' did not match any file(s) known to git
/usr/bin/git checkout -b changeset-release/main
Switched to a new branch 'changeset-release/main'
/usr/bin/git reset --hard cba2d5e90c3819a0bb1629160e4801ab5ff6d3be
HEAD is now at cba2d5e feat!: very first release
/home/runner/.bun/bin/bun run ci:version
$ changeset version
The following error was encountered while generating changelog entries
We have escaped applying the changesets, and no files should have been affected
๐Ÿฆ‹  error TypeError: Cannot read properties of null (reading 'author')
๐Ÿฆ‹  error     at Object.getInfo (/home/runner/work/simple-nominatim/simple-nominatim/node_modules/@changesets/get-github-info/dist/get-github-info.cjs.dev.js:235:12)
๐Ÿฆ‹  error     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
๐Ÿฆ‹  error     at async /home/runner/work/simple-nominatim/simple-nominatim/node_modules/@changesets/changelog-github/dist/changelog-github.cjs.dev.js:122:13
๐Ÿฆ‹  error     at async Object.getReleaseLine (/home/runner/work/simple-nominatim/simple-nominatim/node_modules/@changesets/changelog-github/dist/changelog-github.cjs.dev.js:99:19)
๐Ÿฆ‹  error     at async Promise.all (index 0)
๐Ÿฆ‹  error     at async generateChangesForVersionTypeMarkdown (/home/runner/work/simple-nominatim/simple-nominatim/node_modules/@changesets/apply-release-plan/dist/apply-release-plan.cjs.dev.js:192:22)
๐Ÿฆ‹  error     at async getChangelogEntry (/home/runner/work/simple-nominatim/simple-nominatim/node_modules/@changesets/apply-release-plan/dist/apply-release-plan.cjs.dev.js:247:39)
๐Ÿฆ‹  error     at async /home/runner/work/simple-nominatim/simple-nominatim/node_modules/@changesets/apply-release-plan/dist/apply-release-plan.cjs.dev.js:420:21
๐Ÿฆ‹  error     at async Promise.all (index 0)
๐Ÿฆ‹  error     at async Object.applyReleasePlan [as default] (/home/runner/work/simple-nominatim/simple-nominatim/node_modules/@changesets/apply-release-plan/dist/apply-release-plan.cjs.dev.js:311:31)
error: script "ci:version" exited with code 1 (SIGHUP)
Error: Error: The process '/home/runner/.bun/bin/bun' failed with exit code 1
Error: The process '/home/runner/.bun/bin/bun' failed with exit code 1

Here is my workflow:

name: Continuous Release
on:
  push:
    branches:
      - main
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
  prepare:
    name: Prepare the upcoming release
    runs-on: ubuntu-latest
    steps:
      - name: Checkout ${{ github.ref }}
        uses: actions/checkout@v4
      - uses: ./.github/actions/install-tools-dependencies
      - name: Lint the source code of the packages
        id: lint-source-code
        shell: bash
        run: |
          bun run packages:lint:code
          bun run packages:lint:markdown
      - name: Unit test the packages
        id: unit-test-packages
        shell: bash
        run: bun run packages:test
      - name: Build the packages
        id: build-packages
        shell: bash
        run: bun run packages:build
  release:
    name: Build and release the packages
    needs: prepare
    permissions:
      contents: write
      issues: write
      pull-requests: write
    timeout-minutes: 20
    runs-on: ubuntu-latest
    steps:
      - name: Checkout ${{ github.ref }}
        uses: actions/checkout@v4
      - uses: ./.github/actions/install-tools-dependencies
      - name: Build the packages
        id: build-packages
        shell: bash
        run: bun run packages:build
      - name: Proceed to release
        uses: changesets/action@v1
        with:
          publish: bun run ci:release
          version: bun run ci:version
          commit: "chore: new release"
          title: "chore: new release candidate"
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

And the action to install the tools and dependencies:

name: Install tools and dependencies of the application
description: Local action to install tools and dependencies of the application
runs:
  using: composite
  steps:
    - name: Setup Bun runtime
      uses: antongolub/action-setup-bun@v1
      with:
        cache: true
        cache-bin: true
    - name: Install all the dependencies
      shell: bash
      run: bun install

I am not sure to understand what's going on here.

Okay. I found a solution.

Workaround

I removed this part from my release job:

    permissions:
      contents: write
      issues: write
      pull-requests: write

Then, I set the following permissions in the Actions/General section of my repository Settings (https://github.com/<username>/<repository-name>/settings/actions):

image

Result

image

image

Feedback

This needs to be documented as part of the Getting Started section (or whatever is used) of this changesets/action project.

References