Browse Source

feat(workflows): drop dist and js changes when compile-rebasing

Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
pull/54139/head
skjnldsv 5 months ago
parent
commit
36b510a38a
  1. 38
      .github/workflows/command-compile.yml

38
.github/workflows/command-compile.yml

@ -136,7 +136,41 @@ jobs:
if: ${{ contains(needs.init.outputs.arg1, 'rebase') }}
run: |
git fetch origin '${{ needs.init.outputs.base_ref }}:${{ needs.init.outputs.base_ref }}'
git rebase 'origin/${{ needs.init.outputs.base_ref }}'
# Start the rebase
git rebase 'origin/${{ needs.init.outputs.base_ref }}' || {
# Handle rebase conflicts in a loop
while [ -d .git/rebase-merge ] || [ -d .git/rebase-apply ]; do
echo "Handling rebase conflict..."
# Remove and checkout /dist and /js folders from the base branch
if [ -d "dist" ]; then
rm -rf dist
git checkout origin/${{ needs.init.outputs.base_ref }} -- dist/ 2>/dev/null || echo "No dist folder in base branch"
fi
if [ -d "js" ]; then
rm -rf js
git checkout origin/${{ needs.init.outputs.base_ref }} -- js/ 2>/dev/null || echo "No js folder in base branch"
fi
# Stage all changes
git add .
# Check if there are any changes after resolving conflicts
if git diff --cached --quiet; then
echo "No changes after conflict resolution, skipping commit"
git rebase --skip
else
echo "Changes found, continuing rebase"
git rebase --continue
fi
# Break if rebase is complete
if [ ! -d .git/rebase-merge ] && [ ! -d .git/rebase-apply ]; then
break
fi
done
}
- name: Install dependencies & build
env:
@ -172,7 +206,7 @@ jobs:
- name: Force push
if: ${{ contains(needs.init.outputs.arg1, 'rebase') || contains(needs.init.outputs.arg1, 'amend') }}
run: git push --force origin '${{ needs.init.outputs.head_ref }}'
run: git push --force-with-lease origin '${{ needs.init.outputs.head_ref }}'
- name: Add reaction on failure
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0

Loading…
Cancel
Save