这是我的github actions yml文件。
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
运行之后,我希望所有的git lfs文件都能被下载、检查并准备好使用,但文件的内容却是:
version https://git-lfs.github.com/spec/v1
oid sha256:f23e4c2b1244bc93085dbccf17c447e54sca44650294648df128d58303e4eff
size 58951008
下面我附上实际的github动作日志,以备不时之需。
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
LFS对象似乎只能根据日志来获取。你需要检查LFS文件,以便将指针文件替换成对应的LFS文件。下面是一个修改后的尝试 actions.yml
基于在GitHub Actions上的搜索(之前从未使用过它)。
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
如果LFS对象还没有被获取,那么你可以替换为 git lfs checkout
与 git lfs pull
.
相关问题 : LFS的缓存