fix: feat: lib/vault.sh — helper for agents to create vault PRs on ops repo (#75)
This commit is contained in:
parent
4be719bcef
commit
a54e238282
3 changed files with 225 additions and 2 deletions
|
|
@ -110,15 +110,17 @@ pr_create() {
|
|||
|
||||
# ---------------------------------------------------------------------------
|
||||
# pr_find_by_branch — Find an open PR by head branch name.
|
||||
# Args: branch
|
||||
# Args: branch [api_url]
|
||||
# Stdout: PR number
|
||||
# Returns: 0=found, 1=not found
|
||||
# api_url defaults to FORGE_API if not provided
|
||||
# ---------------------------------------------------------------------------
|
||||
pr_find_by_branch() {
|
||||
local branch="$1"
|
||||
local api_url="${2:-${FORGE_API}}"
|
||||
local pr_num
|
||||
pr_num=$(curl -sf -H "Authorization: token ${FORGE_TOKEN}" \
|
||||
"${FORGE_API}/pulls?state=open&limit=20" | \
|
||||
"${api_url}/pulls?state=open&limit=20" | \
|
||||
jq -r --arg b "$branch" '.[] | select(.head.ref == $b) | .number' \
|
||||
| head -1) || true
|
||||
if [ -n "$pr_num" ]; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue