Skip to content

Commit

Permalink
Update ci_build_merge_manual.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mgough-970 authored Nov 3, 2023
1 parent 9506c75 commit 54853e4
Showing 1 changed file with 25 additions and 17 deletions.
42 changes: 25 additions & 17 deletions .github/workflows/ci_build_merge_manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 54853e4

Please sign in to comment.