mirror of
https://github.com/samsonjs/spirit-tracker.git
synced 2026-03-25 09:25:51 +00:00
fix: PR JS
This commit is contained in:
parent
adce159c75
commit
a29c3920e5
2 changed files with 14 additions and 5 deletions
|
|
@ -45,7 +45,6 @@ jobs:
|
|||
node tools/stviz_apply_issue_edits.js
|
||||
|
||||
- name: Close issue
|
||||
if: always()
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
||||
|
|
|
|||
|
|
@ -404,10 +404,20 @@ sh(`git push -u origin "${branch}"`);
|
|||
const prTitle = `STVIZ: SKU link updates (issue #${ISSUE_NUMBER})`;
|
||||
const prBody = `Automated PR created from issue #${ISSUE_NUMBER}: ${ISSUE_TITLE}`;
|
||||
|
||||
// Create PR and capture URL/number deterministically (no search/index lag)
|
||||
const prUrl = sh(
|
||||
`gh -R "${REPO}" pr create --base data --head "${branch}" --title "${prTitle}" --body "${prBody}" --json url --jq .url`
|
||||
function extractPrUrl(out) {
|
||||
// gh pr create usually prints the PR URL to stdout; be robust in case extra text appears.
|
||||
const m = String(out || "").match(/https?:\/\/\S+\/pull\/\d+\S*/);
|
||||
if (!m) die(`Could not find PR URL in gh output:\n${out}`);
|
||||
return m[0];
|
||||
}
|
||||
|
||||
// Create PR and capture URL/number without relying on unsupported flags
|
||||
const prCreateOut = sh(
|
||||
`gh -R "${REPO}" pr create --base data --head "${branch}" --title "${prTitle}" --body "${prBody}"`
|
||||
);
|
||||
const prUrl = extractPrUrl(prCreateOut);
|
||||
|
||||
|
||||
const prNumber = sh(`gh -R "${REPO}" pr view "${prUrl}" --json number --jq .number`);
|
||||
|
||||
sh(
|
||||
|
|
|
|||
Loading…
Reference in a new issue