Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github actions actions/checkout@v2 lfs: true flag not converting pointers to actual files

This is my github actions yml file:

name: CI

on: [pull_request]

jobs:
  build_ios:
    name: Set up
    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        os: [self-hosted]
        node-version: [10.x]

    steps:
      - name: Checkout github repo (+ download lfs dependencies)
        uses: actions/checkout@v2
        with:
          lfs: true

After it runs I expect all the git lfs files to be downloaded, checked out and ready to use, but instead the content of the file is this:

version https://git-lfs.github.com/spec/v1
oid sha256:f23e4c2b1244bc93085dbccf17c447e54sca44650294648df128d58303e4eff
size 58951008

Below I attach the actual github actions log in case it's helpful:

Run actions/checkout@v2
  with:
    lfs: true
    repository: SudoPlz/test-project-mobile
    token: ***
    ssh-strict: true
    persist-credentials: true
    clean: true
    fetch-depth: 1
    submodules: false
Syncing repository: SudoPlz/test-project-mobile
Getting Git version info
  Working directory is '/Users/sudoplz/Development/tmp/actions-runner/_work/test-project-mobile/test-project-mobile'
  /usr/bin/git version
  git version 2.24.1 (Apple Git-126)
  /usr/bin/git lfs version
  git-lfs/2.8.0 (GitHub; darwin amd64; go 1.12.7)
/usr/bin/git config --local --get remote.origin.url
https://github.com/SudoPlz/test-project-mobile
Removing previously created refs, to avoid conflicts
  /usr/bin/git rev-parse --symbolic-full-name --verify --quiet HEAD
  HEAD
  /usr/bin/git rev-parse --symbolic-full-name --branches
  /usr/bin/git rev-parse --symbolic-full-name --remotes=origin
Cleaning the repository
  /usr/bin/git clean -ffdx
  Removing .jest/
  Removing node_modules/
  Removing patchLog.txt
  /usr/bin/git reset --hard HEAD
  HEAD is now at 21bea25da Merge ab95479fd7dce51551520250ac521532d0079f94 into c70ec18b35029c581b0c0e06566228f69e091d3d
Disabling automatic garbage collection
  /usr/bin/git config --local gc.auto 0
Setting up auth
  /usr/bin/git config --local --name-only --get-regexp core\.sshCommand
  /usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :
  /usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
  /usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :
  /usr/bin/git config --local http.https://github.com/.extraheader AUTHORIZATION: basic ***
/usr/bin/git lfs install --local
Updated git hooks.
Git LFS initialized.
Fetching the repository
  /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +d4be6d58e6a72e54b0b03be61fc508dcee8d7bec:refs/remotes/pull/44/merge
  remote: Enumerating objects: 10, done.        
  remote: Counting objects:  10% (1/10)        
  remote: Counting objects:  20% (2/10)        
  remote: Counting objects:  30% (3/10)        
  remote: Counting objects:  40% (4/10)        
  remote: Counting objects:  50% (5/10)        
  remote: Counting objects:  60% (6/10)        
  remote: Counting objects:  70% (7/10)        
  remote: Counting objects:  80% (8/10)        
  remote: Counting objects:  90% (9/10)        
  remote: Counting objects: 100% (10/10)        
  remote: Counting objects: 100% (10/10), done.        
  remote: Compressing objects:  33% (1/3)        
  remote: Compressing objects:  66% (2/3)    
  remote: Compressing objects: 100% (3/3)        
  remote: Compressing objects: 100% (3/3), done.        
  remote: Total 5 (delta 2), reused 2 (delta 0), pack-reused 0        
  From https://github.com/SudoPlz/test-project-mobile
   + 21bea25da...d4be6d58e d4be6d58e6a72e54b0b03be61fc508dcee8d7bec -> pull/44/merge  (forced update)
Determining the checkout info
Fetching LFS objects
  /usr/bin/git lfs fetch origin refs/remotes/pull/44/merge
  fetch: Fetching reference refs/remotes/pull/44/merge
Checking out the ref
  /usr/bin/git checkout --progress --force refs/remotes/pull/44/merge
  Warning: you are leaving 1 commit behind, not connected to
  any of your branches:

    21bea25da Merge ab95479fd7dce51551520250ac521532d0079f94 into c70ec18b35029c581b0c0e06566228f69e091d3d

  If you want to keep it by creating a new branch, this may be a good time
  to do so with:

   git branch <new-branch-name> 21bea25da

  HEAD is now at d4be6d58e Merge 8d05f53305eaef70a2d4635767b39dbfbe663b5a into c70ec18b35029c581b0c0e06566228f69e091d3d
/usr/bin/git log -1
commit d4be6d58e6a72e54b0b03be61fc508dcee8d7bec
Author: SudoPlz <*@*.*>
Date:   Fri Apr 24 18:38:50 2020 +0000

    Merge 8d05f53305eaef70a2d4635767b39dbfbe663b5a into c70ec18b35029c581b0c0e06566228f69e091d3d
like image 778
SudoPlz Avatar asked Apr 27 '20 16:04

SudoPlz


People also ask

How do I make sure git LFS is working?

If everything is set up correctly, you can verify that git LFS is going to work properly by: git add the file(s) in question. Do one of the following: Run git lfs status and ensure the file(s) in question appear under Git LFS objects to be committed , and that they have the LFS value in parenthesis; or.

Are git LFS files versioned?

Git Large File Storage Git LFS takes advantage of this centralized pattern. Large files are stored in the cloud, and these files are referenced via pointers in local copies of the repo. When a clone or pull occurs, the appropriate version of the file is downloaded from the remote.

Does git LFS track changes?

gitignore file, as Git LFS tracks new files, updates are automatically made to the . gitattributes file. To make sure the changes are being tracked, each time the . gitattributes file is updated, it needs to be staged and commited, otherwise issues may occur later on.


1 Answers

The LFS objects seem to be only fetched based on the log. You need to checkout the LFS files inorder for the pointer files to be replaced with their LFS counterparts. Here's an attempt at a modified actions.yml based on a search on GitHub Actions (never used it before) :

name: CI

on: [pull_request]

jobs:
  build_ios:
    name: Set up
    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        os: [self-hosted]
        node-version: [10.x]

    steps:
      - name: Checkout github repo (+ download lfs dependencies)
        uses: actions/checkout@v2
        with:
          lfs: true
      - name: Checkout LFS objects
        run: git lfs checkout

If the LFS objects have not been fetched, then you can replace git lfs checkout with git lfs pull.

Relevant issues : Cache for LFS

like image 188
Saurabh P Bhandari Avatar answered Oct 13 '22 09:10

Saurabh P Bhandari