question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Branch is dirty. Refusing to base semantic version on uncommitted changes

See original GitHub issue

I had the following build file but could not create a clean build.


#- name: Unity - Builder
#  uses: game-ci/unity-builder@v2.0-alpha-6
name: Build project

on: [push, pull_request]

jobs:
  buildForAllSupportedPlatforms:
    name: Build for ${{ matrix.targetPlatform }}
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        targetPlatform:
          # - StandaloneOSX # Build a macOS standalone (Intel 64-bit).
          # - StandaloneWindows # Build a Windows standalone.
          - StandaloneWindows64 # Build a Windows 64-bit standalone.
          #- StandaloneLinux64 # Build a Linux 64-bit standalone.
          # - iOS # Build an iOS player.
          # - Android # Build an Android .apk standalone app.
          #- WebGL # WebGL.
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
          lfs: true
      - uses: actions/cache@v2
        with:
          path: Library
          key: Library-${{ matrix.targetPlatform }}
          restore-keys: Library-
      - uses: game-ci/unity-builder@v2
        env:
          UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
        with:
          targetPlatform: ${{ matrix.targetPlatform }}
          unityVersion: 2020.3.2f1
          allowDirtyBuild: true
      - uses: actions/upload-artifact@v2
        with:
          name: Build-${{ matrix.targetPlatform }}
          path: build/${{ matrix.targetPlatform }}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
webbertakkencommented, Feb 9, 2022

@ckcollab The error is there for a reason and as stated in the documentation, simply working around the error is not the recommended approach.

https://game.ci/docs/github/builder#allowdirtybuild image

If you working directory has changes since you’ve checked out your branch, this error will show up. The reason for the error and failure is to prevent possible misconfigurations in your workflow. Misconfiguration can potentially lead to bugs in your builds.

The error also indicates which files are “dirty”.

If you’re running test-runner in the same workflow, be sure to add /artifacts. to your .gitignore file.

        with:
          targetPlatform: ${{ matrix.targetPlatform }}

Your configuration should ideally specify only necessary options.

2reactions
webbertakkencommented, Feb 3, 2022

I’m getting this error on a bunch of files in my assets folder

I assume this is because the build process tries to install asset packages here? But I can’t find any documentation or further details as to why these assets would be dirty. Any advice?

Don’t worry, your assets are very clean 😉 just kidding.

It’s the checked out branch that we call dirty when files change after checkout (thus differ from your branch in version control).

1 of two things happened:

  1. You checked out without LFS but your files are stored in LFS
  2. One of the steps in your workflow actually changed all those files in some way.

In case of 1, be sure to checkout all your files. For example

- uses: actions/checkout@v2
  with:
     lfs: true

In case of 2, this is not good practice and that’s exactly why we’re showing throwing an error for it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common issues - GameCI
Error ​. Branch is dirty. Refusing to base semantic version on uncommitted changes. This usually happens with GitHub actions when using unity-builder.
Read more >
Building Unity with GitHub Actions | isaac broyles home
Note caches created on branches are scoped to that branch, regardless of key ... Refusing to base semantic version on uncommitted changes.
Read more >
git - Go Packages
InitRebase initializes a rebase operation to rebase the changes in branch relative to upstream onto another branch. func (*Repository) IsBare ¶.
Read more >
batou - PyPI
A utility for automating multi-host, multi-environment software builds and deployments. Navigation. Project description; Release history; Download files ...
Read more >
Version Control with Subversion
The svn diff command produces this output by comparing your working files against its pristine text-base. Files scheduled for ad-.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found