diff options
Diffstat (limited to 'po')
-rwxr-xr-x | po | 57 |
1 files changed, 0 insertions, 57 deletions
@@ -1,57 +0,0 @@ -#!/bin/sh -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) - project=$(cat .osc/_project) - o_url="${apiurl}/project/show/${project}" -elif [ -f .osc/_package ] ; then - apiurl=$(cat .osc/_apiurl) - project=$(cat .osc/_project) - package=$(cat .osc/_package) - o_url="${apiurl}/package/show/${project}/${package}" -fi - -if [ -z "$o_url" ] ; then - pr_url="$(which_pr)" || true - if [ -n "$pr_url" ] ; then - o_url="$pr_url" - elif [ -d .git ] ; then - if git remote show gitlab >/dev/null 2>&1 ; then - o_url="$(git remote get-url gitlab)" - elif git remote show github >/dev/null 2>&1 ; then - o_url="$(git remote get-url github)" - elif git remote show sourcehut >/dev/null 2>&1 ; then - o_url="$(git remote get-url sourcehut)" - elif git remote show myrepo >/dev/null 2>&1 ; then - o_url="$(git remote get-url myrepo)" - elif git remote show origin >/dev/null 2>&1 ; then - o_url="$(git remote get-url origin)" - else - exit 0 - fi - fi -fi - -[ -z "$o_url" ] || xdg-open "$o_url" >/dev/null 2>&1 |