diff --git a/.github/workflows/pr-import.yml b/.github/workflows/pr-import.yml index fc964681e81..12eba953853 100644 --- a/.github/workflows/pr-import.yml +++ b/.github/workflows/pr-import.yml @@ -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 @@ -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 @@ -126,11 +127,9 @@ 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 "---" @@ -138,9 +137,15 @@ jobs: 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