Skip to content

Commit de403ef

Browse files
committed
More job cleanup
Source-Ref: 0b1499ece7df9132656ae09f844751a33f9ec08e
1 parent d9e908c commit de403ef

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

.github/workflows/sync-import-trigger.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,36 @@ jobs:
7272
echo "head_repo=$(echo "$PR_DATA" | jq -r '.headRepository.name')" >> $GITHUB_OUTPUT
7373
echo "pr_title=$(echo "$PR_DATA" | jq -r '.title')" >> $GITHUB_OUTPUT
7474
75+
# Store body in file (handles multiline and special characters)
76+
echo "$PR_DATA" | jq -r '.body // ""' > /tmp/pr_body.txt
77+
78+
# Determine if this is from a fork
79+
# Compare head repo with the repo where this action is running
80+
HEAD_FULL="${{ github.event.client_payload.head_owner }}/${{ github.event.client_payload.head_repo }}"
81+
if [ "$(echo "$PR_DATA" | jq -r '.headRepositoryOwner.login')/$(echo "$PR_DATA" | jq -r '.headRepository.name')" = "${{ github.repository }}" ]; then
82+
echo "is_fork=false" >> $GITHUB_OUTPUT
83+
else
84+
echo "is_fork=true" >> $GITHUB_OUTPUT
85+
fi
86+
7587
- name: Trigger universe import workflow
7688
if: steps.check-member.outputs.authorized == 'true'
7789
env:
7890
GH_TOKEN: ${{ steps.app-token.outputs.token }}
7991
run: |
92+
# Read PR body from file and escape for JSON
93+
PR_BODY=$(cat /tmp/pr_body.txt | jq -Rs '.')
94+
8095
gh api repos/jleibs/universe/dispatches \
8196
-f event_type=rerun-import \
8297
-f "client_payload[pr_number]=${{ steps.pr-details.outputs.pr_number }}" \
8398
-f "client_payload[head_ref]=${{ steps.pr-details.outputs.head_ref }}" \
8499
-f "client_payload[head_owner]=${{ steps.pr-details.outputs.head_owner }}" \
85100
-f "client_payload[head_repo]=${{ steps.pr-details.outputs.head_repo }}" \
86101
-f "client_payload[pr_title]=${{ steps.pr-details.outputs.pr_title }}" \
87-
-f "client_payload[triggered_by]=${{ github.event.comment.user.login }}"
102+
-f "client_payload[is_fork]=${{ steps.pr-details.outputs.is_fork }}" \
103+
-f "client_payload[triggered_by]=${{ github.event.comment.user.login }}" \
104+
--raw-field "client_payload[pr_body]=$(cat /tmp/pr_body.txt)"
88105
89106
- name: Post acknowledgment
90107
if: steps.check-member.outputs.authorized == 'true'

0 commit comments

Comments
 (0)