Skip to content

"fatal: malformed object name main" when releasing next branch #214

Open
@davenewza

Description

@davenewza

Describe the bug
When running semantic release on my next branch, I get the error fatal: malformed object name main:

[4:50:00 AM] [semantic-release] › ℹ  Running semantic-release version 21.1.1
[4:50:00 AM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/git"
[4:50:00 AM] [semantic-release] › ✔  Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
[4:50:00 AM] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/git"
[4:50:01 AM] [semantic-release] › ✘  An error occurred while running semantic-release: Error: Command failed with exit code 128: git tag --merged main
fatal: malformed object name main
    at makeError (file:///home/runner/work/_actions/cycjimmy/semantic-release-action/v4/node_modules/semantic-release/node_modules/execa/lib/error.js:60:11)
    at handlePromise (file:///home/runner/work/_actions/cycjimmy/semantic-release-action/v4/node_modules/semantic-release/node_modules/execa/index.js:124:[26](https://github.com/teamkeel/keel/actions/runs/10660950567/job/29545714149#step:5:27))
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async getTags (file:///home/runner/work/_actions/cycjimmy/semantic-release-action/v4/node_modules/semantic-release/lib/git.js:33:11)
    at async file:///home/runner/work/_actions/cycjimmy/semantic-release-action/v4/node_modules/semantic-release/lib/branches/get-tags.js:20:9
    at async Promise.all (index 0)
    at async next (file:///home/runner/work/_actions/cycjimmy/semantic-release-action/v4/node_modules/semantic-release/node_modules/p-reduce/index.js:15:44) {
  shortMessage: 'Command failed with exit code 1[28](https://github.com/teamkeel/keel/actions/runs/10660950567/job/29545714149#step:5:29): git tag --merged main',
  command: 'git tag --merged main',
  escapedCommand: 'git tag --merged main',
  exitCode: 128,
  signal: undefined,
  signalDescription: undefined,
  stdout: '',
  stderr: 'fatal: malformed object name main',
  cwd: '/home/runner/work/keel/keel',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}
Error: Error: Command failed with exit code 128: git tag --merged main
fatal: malformed object name main

I am checking out the next branch in the prior step. Here is my full yaml spec:

  semantic-release:
    needs: instantiate
    runs-on: ubuntu-latest
    outputs:
      is_published: ${{ steps.semantic.outputs.new_release_published }}
      new_version: ${{ steps.semantic.outputs.new_release_version }}
    steps:
    - name: With branch
      shell: bash
      run: |
        echo ${{ needs.instantiate.outputs.branch }}
    - name: Instantiation check
      if: ${{ needs.instantiate.outputs.branch == '' || needs.instantiate.outputs.channel == '' }}
      uses: actions/github-script@v6
      with:
        script: |
          core.setFailed('branch or channel not set')
    - name: Checkout
      uses: actions/checkout@v4
      with:
        persist-credentials: false
        ref: ${{ needs.instantiate.outputs.branch }}
        fetch-depth: 0
    - name: Semantic Release
      id: semantic
      uses: cycjimmy/semantic-release-action@v4
      with:
        semantic_version: 21.1.1
        extra_plugins: |
          @semantic-release/git
      env:
        GITHUB_TOKEN: ${{ secrets.KEEL_CI_SEMANTIC_RELEASE }}
    - name: Version tag created
      if: ${{ steps.semantic.outputs.is_published == 'true' }}
      run: |
        echo v${{ steps.semantic.outputs.new_release_version }}

And the .releaserc file in the root of my repo looks like this:

{
  "branches": [
    { "name": "main" }, 
    { "name": "next", "prerelease": true }, 
    { "name": "prerelease", "prerelease": true }
  ],
  "repositoryUrl": "https://github.com/teamkeel/keel",
  "debug": true,
  "dryRun": false,
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/git"
  ]
} 

The GITHUB_TOKEN definitely has read and write access to the repo branches and content.

Expected behavior
I expect the next branch to be released and tagged with the new version 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