0

I am using the following Github action:

name: Python application

on:
  push:
    branches: [ "master" ]

permissions:
  contents: read

jobs:
  bump_version:
    if: "!startsWith(github.event.head_commit.message, 'bump:')"
    runs-on: ubuntu-latest
    name: "Bump version and create changelog with commitizen"
    steps:
      - name: Check out
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
          token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
      - id: cz
        name: Create bump and changelog
        uses: commitizen-tools/commitizen-action@master
        with:
          github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
          lfs: true
      - name: Print Version
        run: echo "Bumped to version ${{ steps.cz.outputs.version }}"

The step cz that makes a commit has the option lfs: true but when the Github action is executing I get the following error:

Current branch master is up to date.

This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting '.git/hooks/pre-push'.

error: failed to push some refs to 

How to can I solve this error in order to allow that cz makes a commit?

tripleee
  • 175,061
  • 34
  • 275
  • 318
Tlaloc-ES
  • 4,825
  • 7
  • 38
  • 84
  • That action doesn't have an `lfs` parameter, see [here](https://github.com/commitizen-tools/commitizen-action/blob/master/action.yml). Did you mean to set that parameter on the `checkout` step? – Benjamin W. Jan 22 '23 at 19:53
  • I guessed that lfs:true was a github action option not a particular github-action option @BenjaminW. – Tlaloc-ES Jan 22 '23 at 20:05
  • The error is the message posted `error: failed to push some refs to 'https://github.com/....'` @matt – Tlaloc-ES Jan 22 '23 at 20:06
  • It's not a global option. The `action.yml` file of an action defines what parameters are available. – Benjamin W. Jan 22 '23 at 20:18

1 Answers1

1

Try passing the lfs: true parameter to the checkout action and then explicitly checkout LFS files:

steps:
  - uses: actions/checkout@v3
    with:
      lfs: true

  - name: Checkout LFS objects
    run: git lfs checkout

According to the actions/checkout documentation:

# Whether to download Git-LFS files
# Default: false
lfs: ''

git lfs checkout - downloads and checkouts large files from a Git LFS repository.

In addition, there is a GH Action that provides a caching mechanism for LFS files - Cached LFS checkout.

Additional references:

Andrii Bodnar
  • 1,672
  • 2
  • 17
  • 24