File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 11name : CI Workflow
22
3- # Trigger the workflow when pushing to main (includes PR merges) or on PR events
3+ # Trigger on PR events and direct pushes to main (but not PR merges)
44on :
55 push :
66 branches :
@@ -47,13 +47,27 @@ jobs:
4747 pytest
4848
4949 - name : Commit and push the generated .dylib file
50- if : github.ref == 'refs/heads/main'
50+ # Skip if this is a PR merge (indicated by commit message containing "Merge pull request")
51+ if : github.event_name == 'pull_request' || !contains(github.event.head_commit.message, 'Merge pull request')
5152 run : |
5253 git config --local user.name "GitHub Action"
5354 git config --local user.email "action@github.com"
55+
56+ # Determine target branch
57+ if [ "${{ github.event_name }}" = "pull_request" ]; then
58+ TARGET_BRANCH="${{ github.event.pull_request.head.ref }}"
59+ else
60+ TARGET_BRANCH="${{ github.ref_name }}"
61+ fi
62+
63+ # Fetch and checkout the target branch
5464 git fetch origin
55- git pull origin ${{ github.ref_name }} --rebase
65+ git checkout -B $TARGET_BRANCH origin/$TARGET_BRANCH
66+
67+ # Add and commit the .dylib file
5668 git add ./loop_to_python_api/libLoopAlgorithmToPython.dylib
5769 git commit -m "Add generated libLoopAlgorithmToPython.dylib" || echo "No changes to commit"
58- git push origin HEAD:${{ github.ref_name }}
70+
71+ # Push to the target branch
72+ git push origin $TARGET_BRANCH
5973
You can’t perform that action at this time.
0 commit comments