Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checking out a sub-path using git-lfs #66

Closed
asheesh-reduct opened this issue Nov 8, 2019 · 1 comment
Closed

Checking out a sub-path using git-lfs #66

asheesh-reduct opened this issue Nov 8, 2019 · 1 comment

Comments

@asheesh-reduct
Copy link

Hi there!

(BTW -- GitHub actions, and this checkout action, are both excellent, so I want to start by saying thank you!)

At $WORK, we use a mono-repo-style repository. Therefore, our GitHub Actions events usually only affect one sub-directory of the repository. We use git-lfs to store some files, so I enabled the lfs checkout in the checkout action.

Unfortunately, this has resulted in a huge amount of LFS bandwidth on our end, sadly, so I'd like to try another approach.

I'd like either (a) a built-in way for the checkout action to only check out lfs data from some paths, or (b) to figure out how to do that myself. I'd be happy to do (b), except I can't figure out how the checkout action is authenticating to lfs to download its data.

Here's a sample YAML file that shows what I'm trying:

name: reduct-app build smoke-test

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [10.x]
    steps:
      - uses: actions/checkout@v1
        with:
          fetch-depth: 1
      - name: Get reduct-app git-lfs files
        run: |
          echo $GITHUB_TOKEN
          echo ${{ github.token }}
          echo ${{ secrets.GITHUB_TOKEN }}
          git -c http.https://github.com.extraheader="AUTHORIZATION: basic ${{ secrets.GITHUB_TOKEN }}" lfs pull --include reduct-app/
          git -c http.https://github.com.extraheader="AUTHORIZATION: basic $GITHUB_TOKEN" lfs checkout reduct-app/
        #env:
        #  GITHUB_TOKEN: ${{ secrets.CLONE_TOKEN }}
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - name: yarn install
        run: |
          cd reduct-app && yarn install --frozen-lockfile
      - name: yarn build
        run: |
          cd reduct-app && yarn build --all
        env:
          CI: true

Thanks!

@asheesh-reduct
Copy link
Author

Hi all,

I was able to accomplish what I wanted by adding this to my YAML file:

+      - name: Configure git-lfs to ignore most files
+        run: |
+          git config --global lfs.fetchinclude 'reduct-app/**'
       - uses: actions/checkout@v1

I'll happily close this for now. I do think it'd be useful for checkout to expose this as a configuration parameter someday, but it's not essential. :)

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant