Skip to content

Commit ce3ba12

Browse files
committed
Configure Git LFS authentication and fetch LFS objects for submodule
1 parent d0feb5c commit ce3ba12

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

.github/workflows/docs-build.yml

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,26 +71,34 @@ jobs:
7171
# only Pytorch has/uses notebooks
7272
submodules: ${{ matrix.pkg-name == 'pytorch' }}
7373
lfs: false # Disable LFS during checkout to avoid auth issues
74-
- name: Setup LFS and fetch notebooks manually
74+
- name: Configure Git LFS authentication
7575
if: ${{ matrix.pkg-name == 'pytorch' }}
76+
env:
77+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7678
run: |
77-
cd _notebooks
78-
79-
# Skip LFS entirely - download files directly from GitHub
80-
echo "Bypassing LFS - downloading files directly via GitHub API..."
81-
82-
# List LFS tracked files and download them directly
83-
git lfs ls-files --name-only | while read file; do
84-
if [ -f "$file" ]; then
85-
echo "Downloading $file..."
86-
# Download the actual file content from GitHub raw API
87-
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
88-
-L "https://github.com/Lightning-AI/lightning-tutorials/raw/HEAD/$file" \
89-
-o "$file"
90-
fi
91-
done
92-
93-
echo "Direct download completed"
79+
# Configure Git LFS with proper authentication using recommended approach
80+
git config --global credential.helper store
81+
echo "https://${{ github.actor }}:${GH_TOKEN}@github.com" > ~/.git-credentials
82+
83+
# Set LFS configuration to use GitHub token
84+
git config --global lfs."https://github.com/".access basic
85+
git config --global lfs."https://github.com/".locksverify false
86+
87+
- name: Fetch LFS objects for submodule
88+
if: ${{ matrix.pkg-name == 'pytorch' }}
89+
working-directory: _notebooks
90+
env:
91+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92+
run: |
93+
# Initialize LFS in submodule context
94+
git lfs install --local
95+
96+
# Set the correct LFS endpoint with authentication (using the actual repo name)
97+
git config lfs.url "https://${{ github.actor }}:${GH_TOKEN}@github.com/Lightning-AI/tutorials.git/info/lfs"
98+
99+
# Fetch and checkout LFS objects
100+
git lfs fetch --all
101+
git lfs checkout
94102
- uses: actions/setup-python@v6
95103
with:
96104
python-version: "3.10"

0 commit comments

Comments
 (0)