2
0
Fork 0
backend/backend-update

49 lines
1.0 KiB
Plaintext
Raw Permalink Normal View History

2019-09-01 01:19:18 +08:00
#!/bin/bash
set -e
. gitea-creds
2019-09-01 01:35:58 +08:00
repo=beep/backend
2019-09-01 01:19:18 +08:00
branch="$1"
2019-09-01 01:35:58 +08:00
message="$2"
2019-09-01 01:19:18 +08:00
if [[ -z $branch ]] || [[ $branch = "-h" ]]; then
2019-09-01 01:35:58 +08:00
echo "Usage: $0 type/short-description [message]"
2019-09-01 01:19:18 +08:00
exit 1
fi
git checkout master
git checkout -b "$branch"
git submodule foreach git pull origin master
git add .
updated=$(git diff master --name-status | cut -f 2)
git commit -S -m "$branch: Bump $updated"
git push --set-upstream origin "$branch"
git checkout master
2019-09-01 01:35:58 +08:00
echo "Creating pull request..."
path_to_httpie=$(which http)
if [ ! -x "$path_to_httpie" ] ; then
echo "HTTPie not installed. Please install it at (https://httpie.org/doc#installation)"
fi
path_to_jq=$(which jq)
if [ ! -x "$path_to_jq" ] ; then
echo "JQ not installed. Please install it at (https://stedolan.github.io/jq/download/)"
fi
url=$(http --check-status -b POST \
$GITEA_URL/api/v1/repos/$repo/pulls \
Authorization:"token $GITEA_API_TOKEN" \
base=master head="$branch" \
title="$branch" | jq .html_url -r)
2019-09-01 01:47:57 +08:00
echo
echo "Created a new pull request for '$repo':"
2019-09-01 01:35:58 +08:00
echo " $url"
2019-09-01 01:47:57 +08:00
echo