diff --git a/.github/cpr.sh b/.github/cpr.sh index eb5d89d4f..322259d14 100755 --- a/.github/cpr.sh +++ b/.github/cpr.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash # # git config --global alias.cpr '!sh .github/cpr.sh' diff --git a/.github/pfpr.sh b/.github/pfpr.sh new file mode 100755 index 000000000..848147cb5 --- /dev/null +++ b/.github/pfpr.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# +# git config --global alias.pfpr '!sh .github/pfpr.sh' + +set -e # stop on error + +usage="$(basename "$0") pr -- Push force a Pull Request branch" + +if [ "$#" -ne 1 ]; then + echo "Illegal number of parameters" + echo "$usage" >&2 + exit 1 +fi + +command -v jq >/dev/null 2>&1 || { echo "I require jq but it's not installed. Aborting." >&2; exit 1; } + +set -x # echo on + +initial=$(git rev-parse --abbrev-ref HEAD) +pr=$1 +remote=$(curl -s https://api.github.com/repos/containous/traefik/pulls/$pr | jq -r .head.repo.owner.login) +branch=$(curl -s https://api.github.com/repos/containous/traefik/pulls/$pr | jq -r .head.ref) + +git push --force-with-lease $remote $pr--$branch:$branch diff --git a/.github/rmpr.sh b/.github/rmpr.sh index 2f9a6f558..1ca63bf15 100755 --- a/.github/rmpr.sh +++ b/.github/rmpr.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash # # git config --global alias.rmpr '!sh .github/rmpr.sh' diff --git a/.github/rpr.sh b/.github/rpr.sh index 57e9f7a9b..b96cd9b77 100755 --- a/.github/rpr.sh +++ b/.github/rpr.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash # # git config --global alias.rpr '!sh .github/rpr.sh' @@ -33,4 +33,4 @@ trap clean EXIT .github/cpr.sh $pr git rebase $base -git push --force-with-lease $remote "$pr--$branch" +git push --force-with-lease $remote $pr--$branch:$branch