aboutsummaryrefslogtreecommitdiffstats
path: root/po
diff options
context:
space:
mode:
Diffstat (limited to 'po')
-rwxr-xr-xpo19
1 files changed, 17 insertions, 2 deletions
diff --git a/po b/po
index a2ac3a8..75faecb 100755
--- a/po
+++ b/po
@@ -1,11 +1,26 @@
#!/bin/sh
-set -eux
+set -eu
if [ ! -d .osc ] && [ ! -d .git ] ; then
echo 'This program must be run from an project directory.'
exit 42
fi
+which_pr() {
+ TOKEN=$(pass show dev/github.com|awk '/^token:/ {print $2}')
+ ORIG_USER=$(git remote get-url origin 2>/dev/null|awk -F/ '{print $4}')
+ REPO=$(git remote get-url origin 2>/dev/null|awk -F'[/.]' '{print $6}')
+ USER=$(git remote get-url github 2>/dev/null|awk -F/ '{print $4}')
+ BRANCH=$(git rev-parse --abbrev-ref HEAD)
+
+ curl -s -L \
+ -H "Accept: application/vnd.github+json" \
+ -H "Authorization: Bearer $TOKEN" \
+ -H "X-GitHub-Api-Version: 2022-11-28" \
+ "https://api.github.com/repos/$ORIG_USER/$REPO/pulls?head=mcepl:$BRANCH" \
+ | jq -r .[].html_url 2>/dev/null
+}
+
o_url=""
if [ -f .osc/_packages ] ; then
apiurl=$(cat .osc/_apiurl)
@@ -19,7 +34,7 @@ elif [ -f .osc/_package ] ; then
fi
if [ -z "$o_url" ] ; then
- pr_url="$(gh-which-pr)" || true
+ pr_url="$(which_pr)" || true
if [ -n "$pr_url" ] ; then
o_url="$pr_url"
elif [ -d .git ] ; then