@@ -215,8 +215,9 @@ jobs:
215215
216216 let existingBody = ""
217217 try {
218+ const owner = repo.split("/")[0]
218219 const out = execSync(
219- `gh pr view docs/release-docs-staging --repo ${repo} --json body -- jq '.body'`,
220+ `gh api "repos/${repo}/pulls?head=${owner}: docs/release-docs-staging&state=open" --jq '.[0] .body'`,
220221 { encoding: "utf8" }
221222 ).trim()
222223 if (out !== "null" && out !== "") existingBody = out
@@ -239,16 +240,22 @@ jobs:
239240 writeFileSync("/tmp/pr-body.md", body)
240241 EOF
241242
242- PR_NUMBER=$(gh pr view docs/release-docs-staging --repo "$REPO" --json number --jq '.number' 2>/dev/null || echo "")
243- if [ -n "$PR_NUMBER" ]; then
244- gh pr edit "$PR_NUMBER" --repo "$REPO" \
245- --title "chore(docs): doc changes for next release (automated)" \
246- --body-file /tmp/pr-body.md
243+ REPO_OWNER="${REPO%%/*}"
244+ PR_NUMBER=$(gh api "repos/$REPO/pulls?head=${REPO_OWNER}:docs/release-docs-staging&state=open" --jq '.[0].number' 2>/dev/null || echo "")
245+ if [ -n "$PR_NUMBER" ] && [ "$PR_NUMBER" != "null" ]; then
246+ gh api "repos/$REPO/pulls/$PR_NUMBER" \
247+ --method PATCH \
248+ --field title="chore(docs): doc changes for next release (automated)" \
249+ --field body="$(cat /tmp/pr-body.md)"
247250 else
248- gh pr create --repo "$REPO" \
249- --base develop \
250- --head docs/release-docs-staging \
251- --title "chore(docs): doc changes for next release (automated)" \
252- --label "type: chore" \
253- --body-file /tmp/pr-body.md
251+ PR_NUMBER=$(gh api "repos/$REPO/pulls" \
252+ --method POST \
253+ --field title="chore(docs): doc changes for next release (automated)" \
254+ --field body="$(cat /tmp/pr-body.md)" \
255+ --field base="develop" \
256+ --field head="docs/release-docs-staging" \
257+ --jq '.number')
258+ gh api "repos/$REPO/issues/$PR_NUMBER/labels" \
259+ --method POST \
260+ --field 'labels[]=type: chore'
254261 fi
0 commit comments