Skip to content

Instantly share code, notes, and snippets.

@TingPing
Last active October 16, 2017 15:58
Show Gist options
  • Save TingPing/62714aea793856e42c7c556dc46caf49 to your computer and use it in GitHub Desktop.
Save TingPing/62714aea793856e42c7c556dc46caf49 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -euf -o pipefail
id=$1
pr=$2
if [ ! -d "$id" ]; then
mkdir $id
pushd $id
git init
gh pull-request --user flathub --repo flathub --number "$pr" --fetch --merge
# If they forked the new-pr branch it has an empty commit, remove it
git filter-branch --parent-filter 'sed -e "s/-p 746ea89cc4ff85ad2dbc05fb47efde23de4062f8//"' -- --all
else
pushd $id
fi
gh repo --new "$id" --organization flathub
git remote add origin "git@github.com:flathub/$id.git"
git push --set-upstream origin master
gh pull-request --user flathub --repo flathub --number "$pr" --comment "Repository has been created: https://github.com/flathub/$id"
gh pull-request --user flathub --repo flathub --number "$pr" --close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment