diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 69233c4..428f228 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,6 @@ name: CI Workflow -# Trigger the workflow when pushing to main (includes PR merges) or on PR events +# Trigger on PR events and direct pushes to main (but not PR merges) on: push: branches: @@ -47,13 +47,27 @@ jobs: pytest - name: Commit and push the generated .dylib file - if: github.ref == 'refs/heads/main' + # Skip if this is a PR merge (indicated by commit message containing "Merge pull request") + if: github.event_name == 'pull_request' || !contains(github.event.head_commit.message, 'Merge pull request') run: | git config --local user.name "GitHub Action" git config --local user.email "action@github.com" + + # Determine target branch + if [ "${{ github.event_name }}" = "pull_request" ]; then + TARGET_BRANCH="${{ github.event.pull_request.head.ref }}" + else + TARGET_BRANCH="${{ github.ref_name }}" + fi + + # Fetch and checkout the target branch git fetch origin - git pull origin ${{ github.ref_name }} --rebase + git checkout -B $TARGET_BRANCH origin/$TARGET_BRANCH + + # Add and commit the .dylib file git add ./loop_to_python_api/libLoopAlgorithmToPython.dylib git commit -m "Add generated libLoopAlgorithmToPython.dylib" || echo "No changes to commit" - git push origin HEAD:${{ github.ref_name }} + + # Push to the target branch + git push origin $TARGET_BRANCH diff --git a/loop_to_python_api/libLoopAlgorithmToPython.dylib b/loop_to_python_api/libLoopAlgorithmToPython.dylib index 8b75710..274a755 100755 Binary files a/loop_to_python_api/libLoopAlgorithmToPython.dylib and b/loop_to_python_api/libLoopAlgorithmToPython.dylib differ