@@ -15,21 +15,20 @@ jobs:
1515 (github.event_name == 'pull_request') ||
1616 (github.event_name == 'issue_comment' &&
1717 contains(github.event.comment.body, '!pr-diff') &&
18- (github.event.comment.author_association == 'COLLABORATOR' || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') &&
18+ (github.event.comment.author_association == 'CONTRIBUTOR' || github.event.comment.author_association == ' COLLABORATOR' || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') &&
1919 github.event.issue.pull_request)
2020 steps :
2121 - name : Get PR head SHA
2222 id : get-pr-sha
2323 run : |
24- if [ "${{ github.event_name }}" == "pull_request" ]; then
25- echo "pr_sha=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
26- echo "Retrieved PR head SHA: ${{ github.event.pull_request.head.sha }}"
27- else
28- PR_URL="${{ github.event.issue.pull_request.url }}"
29- SHA=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" $PR_URL | jq -r '.head.sha')
30- echo "pr_sha=$SHA" >> $GITHUB_OUTPUT
31- echo "Retrieved PR head SHA from API: $SHA"
32- fi
24+ PR_URL="${{ github.event.issue.pull_request.url || github.event.pull_request.url }}"
25+ # https://api.github.com/repos/OpenManus/pulls/1
26+ RESPONSE=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" $PR_URL)
27+ SHA=$(echo $RESPONSE | jq -r '.head.sha')
28+ TARGET_BRANCH=$(echo $RESPONSE | jq -r '.base.ref')
29+ echo "pr_sha=$SHA" >> $GITHUB_OUTPUT
30+ echo "target_branch=$TARGET_BRANCH" >> $GITHUB_OUTPUT
31+ echo "Retrieved PR head SHA from API: $SHA, target branch: $TARGET_BRANCH"
3332 - name : Check out code
3433 uses : actions/checkout@v4
3534 with :
4948 OPENAI_BASE_URL : ${{ secrets.OPENAI_BASE_URL }}
5049 GH_TOKEN : ${{ github.token }}
5150 PR_NUMBER : ${{ github.event.pull_request.number || github.event.issue.number }}
51+ TARGET_BRANCH : ${{ steps.get-pr-sha.outputs.target_branch }}
5252 run : |-
5353 cat << 'EOF' > /tmp/_workflow_core.py
5454 import os
5959
6060 def get_diff():
6161 result = subprocess.run(
62- ['git', 'diff', 'origin/main ...HEAD'],
62+ ['git', 'diff', 'origin/' + os.getenv('TARGET_BRANCH') + ' ...HEAD'],
6363 capture_output=True, text=True, check=True)
6464 return '\n'.join(
6565 line for line in result.stdout.split('\n')
0 commit comments