-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9506c75
commit 54853e4
Showing
1 changed file
with
25 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,27 +113,35 @@ jobs: | |
git config pull.rebase false | ||
git config --global user.name "GitHub Actions" | ||
git config --global user.email "[email protected]" | ||
- name: Replace files with the executed notebooks | ||
run: | | ||
git fetch --all | ||
for branch in $(git branch -r | grep 'storage-' | sed 's/origin\///'); do | ||
echo "Replacing files in gh-storage with the ones from $branch" | ||
git fetch origin $branch | ||
git checkout $branch -- . | ||
git commit -am "Replaced executed notebook ${{ matrix.notebook }} from $branch" || echo "No changes to commit for ${{ matrix.notebook }}" | ||
done | ||
- name: Push changes to gh-storage | ||
run: | | ||
git push origin gh-storage --force | ||
- name: Delete unique branches | ||
run: | | ||
git fetch --prune | ||
for branch in $(git branch -r | grep 'storage-' | sed 's/origin\///'); do | ||
git push origin --delete $branch | ||
BRANCHES=$(git branch -r | grep 'storage-' | sed 's/origin\///') | ||
for BRANCH in $BRANCHES; do | ||
# Extract the notebook path from the branch name | ||
NOTEBOOK=$(echo $BRANCH | sed 's/storage-[0-9]*-//; s/_/\//g') | ||
echo "Replacing file in gh-storage with the one from $BRANCH" | ||
git fetch origin $BRANCH | ||
git checkout "origin/$BRANCH" -- "$NOTEBOOK" | ||
# If the notebook exists and was checked out, commit it to gh-storage | ||
if [ -f "$NOTEBOOK" ]; then | ||
git add "$NOTEBOOK" | ||
git commit -m "Update executed notebook from $BRANCH" -- "$NOTEBOOK" | ||
# Push the change to the gh-storage branch | ||
git push origin gh-storage | ||
else | ||
echo "Notebook file $NOTEBOOK was not found in $BRANCH." | ||
fi | ||
done | ||
- name: Delete unique branches | ||
run: | | ||
git fetch --prune | ||
BRANCHES=$(git branch -r | grep 'storage-' | sed 's/origin\///') | ||
for BRANCH in $BRANCHES; do | ||
git push origin --delete $BRANCH | ||
done | ||
generate_html: | ||
runs-on: ubuntu-latest | ||
|