feat(github): push force contributor branch.

This commit is contained in:
Fernandez Ludovic 2017-05-04 20:34:59 +02:00
parent 3fd6da06e0
commit c00c240c14
4 changed files with 28 additions and 4 deletions

2
.github/cpr.sh vendored
View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env bash
#
# git config --global alias.cpr '!sh .github/cpr.sh'

24
.github/pfpr.sh vendored Executable file
View file

@ -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

2
.github/rmpr.sh vendored
View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env bash
#
# git config --global alias.rmpr '!sh .github/rmpr.sh'

4
.github/rpr.sh vendored
View file

@ -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