Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .github/workflows/pr-import.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ jobs:
run: |
PR_JSON=$(gh pr view ${{ github.event.inputs.subrepo-pr-number }} \
--repo ${{ github.event.inputs.subrepo-upstream }} \
--json title,body,headRefName,headRepository \
--jq '{title: .title, body: .body, head_ref: .headRefName, head_repo: .headRepository.cloneUrl}')
--json title,body,headRefName,headRepository,isDraft \
--jq '{title: .title, body: .body, head_ref: .headRefName, head_repo: .headRepository.cloneUrl, is_draft: .isDraft}')

echo "$PR_JSON" > pr.json

Expand All @@ -102,6 +102,7 @@ jobs:

echo "head_ref=$(jq -r .head_ref pr.json)" >> $GITHUB_OUTPUT
echo "head_repo=$(jq -r .head_repo pr.json)" >> $GITHUB_OUTPUT
echo "is_draft=$(jq -r .is_draft pr.json)" >> $GITHUB_OUTPUT

- name: Create new branch for import
id: import-branch
Expand All @@ -126,21 +127,25 @@ jobs:
SUBREPO_REPO="${{ github.event.inputs.subrepo-repo }}"
SUBREPO_PR_NUMBER="${{ github.event.inputs.subrepo-pr-number }}"
SUBREPO_URL="https://github.com/$SUBREPO_REPO/pull/$SUBREPO_PR_NUMBER"

AUTHOR=$(gh pr view "$SUBREPO_PR_NUMBER" --repo "$UPSTREAM_REPO" --json author --jq .author.login)

echo "${{ steps.prdata.outputs.body }}" > pr_body.txt

{
echo ""
echo "---"
echo "🔁 Imported from [$SUBREPO_REPO#$SUBREPO_PR_NUMBER]($SUBREPO_URL)"
echo "🧑‍💻 Originally authored by @$AUTHOR"
} >> pr_body.txt

DRAFT_FLAG=""
if [[ "${{ steps.prdata.outputs.is_draft }}" == "true" ]]; then
DRAFT_FLAG="--draft"
fi

gh pr create \
--base develop \
--head "${{ steps.import-branch.outputs.import_branch }}" \
--title "$PR_TITLE" \
--label "imported pr" \
$DRAFT_FLAG \
--body-file pr_body.txt