nixpkgs-update/delete-merged.sh

21 lines
665 B
Bash
Raw Normal View History

2018-03-17 18:07:03 +03:00
#! /usr/bin/env bash
set -euxo pipefail
2018-03-27 06:50:09 +03:00
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
GITHUB_TOKEN="$(cat "$SCRIPT_DIR"/github_token.txt)"
export GITHUB_TOKEN
# shellcheck source=setup-nixpkgs.sh
source "$SCRIPT_DIR/setup-nixpkgs.sh"
2018-03-17 18:07:03 +03:00
git fetch --prune origin
git fetch --prune upstream
git checkout master
git reset --hard upstream/master
git branch -ra --merged | grep "origin/auto-update/" | sed -e 's|^ remotes/origin/\(.*\)|git push origin :\1|' | while IFS= read -r line; do eval "$line"; done || true
git branch -a --merged | grep "auto-update/" | sed -e 's|^\(.*\)|git branch -d \1|' | while IFS= read -r line; do eval "$line"; done