Skip to content

Error Finding Base Tag 'last-release' During GitHub Action Execution #845

@mohijalili

Description

@mohijalili

Description

I am encountering an issue when running the semver for the first time and subsequently when triggered by GitHub Actions. Initially, I receive the following message:

[lib1] 🟠 No previous version tag found, fallback to version 0.0.0.
New version will be calculated based on all changes since first commit.
If your project is already versioned, please tag the latest release commit with lib1_x.y.z and run this command again.

After removing the tags and running the action again, I encounter this error:

Run npx nx affected --base=last-release --target=version --baseBranch=main --trackDeps=true --allowEmptyRelease=true --dry-run=true

fatal: ambiguous argument 'last-release': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
nx affected
Run target for affected projects
...
Error: Command failed: git diff --name-only --no-renames --relative "last-release" "HEAD"
fatal: ambiguous argument 'last-release': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
...

GitHub Action Configuration

Below is the configuration of my GitHub Action for semantic release:

name: Semantic Release

on:
  push:
    branches: ['main']
  workflow_dispatch:

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Use Node.js
        uses: actions/[email protected]
        with:
          node-version: 18.10.0
      - name: Setup Git
        run: |
          git config --global user.email ${{ secrets }}
          git config --global user.name ${{secrets }}
          git config --global credential.helper store
      - run: npm ci
      - name: Version
        shell: bash
        run: npx nx affected --base=last-release --target=version --baseBranch=main --trackDeps=true --allowEmptyRelease=true --dry-run=true
      - name: Tag last-release
        shell: bash
        run: |
          git tag -f last-release
          echo "https://${{ secrets }}:${{ secrets }}@github.com/${{ github.repository }}.git" > .git/credentials
          git push origin last-release --force

Each project has the following config:

    "version": {
      "executor": "@jscutlery/semver:version",
      "options": {
        "preset": "angular",
        "baseBranch": "HEAD:main",
        "tagPrefix": "lib1_",
        "push": true,
        "trackDeps": true,
        "commitMessageFormat": "feat({projectName}): release version {version} [skip ci]"
      }
    }

Additional Context

  • Node.js version: 18.10.0
  • "@nx/storybook": "16.10.0"
  • "@jscutlery/semver": "^5.2.2",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions