tidy up scripts (#447)
This commit is contained in:
parent
966204814e
commit
eb2f9f2c25
4 changed files with 1 additions and 78 deletions
|
|
@ -1,40 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# add and remove tags from an github issue, api token is taken from env ($PR_VALIDATOR_GH_TOKEN)
|
||||
# usage: ghtag ISSUE_NR OWNER REPO ADD_TAGS RM_TAGS
|
||||
#
|
||||
# ADD_TAGS should be json with tokens you want to add, as in: ["tested"]
|
||||
# RM_TAGS should be a list of words, like "building bananas"
|
||||
function ghtag {
|
||||
if [[ "$PR_VALIDATOR_GH_TOKEN" == "" ]]
|
||||
then
|
||||
echoerr "Env variable PR_VALIDATOR_GH_TOKEN was empty, unable to call github api!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
issue=$1
|
||||
owner=$2
|
||||
repo=$3
|
||||
add=$4
|
||||
remove=$5
|
||||
|
||||
# checking for existing tags
|
||||
currentTagsJson=`curl -s -H "Authorization: token $PR_VALIDATOR_GH_TOKEN" https://api.github.com/repos/$owner/$repo/issues/$issue/labels`
|
||||
currentTags=`echo "$currentTagsJson" | python -mjson.tool | grep '"name":' | awk '{ print $2 }' | sed s/\"//g | sed s/,//g`
|
||||
|
||||
# adding new tags - we do want to show these, always performing
|
||||
curl -s -H "Authorization: token $PR_VALIDATOR_GH_TOKEN" https://api.github.com/repos/$owner/$repo/issues/$issue/labels -X POST -d $add > /dev/null
|
||||
|
||||
# removing tags
|
||||
for d in $remove
|
||||
do
|
||||
# only delete tags that actually are set on the issue, otherwise github shows these "removed tag" events,
|
||||
# even if the tag never was previously set - which is confusing / verbose
|
||||
if [[ $currentTags == *$d* ]]
|
||||
then
|
||||
curl -s -H "Authorization: token $PR_VALIDATOR_GH_TOKEN" https://api.github.com/repos/$owner/$repo/issues/$issue/labels/$d -X DELETE > /dev/null
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
echoerr() { echo "$@" 1>&2; }
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/sh
|
||||
sctags.bat -E -R . -f TAGS
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
cat <<'EOT'
|
||||
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
@ This command rewrites GIT history like git-rebase. Beware never to rewrite @
|
||||
@ trees which are already published, as that would deeply upset all cloning @
|
||||
@ repos. For more details see 'git help rebase'. Tread carefully! @
|
||||
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
EOT
|
||||
read -p "I know what I am doing: " answer
|
||||
test "$answer" = yes || exit 1
|
||||
|
||||
set -o errexit
|
||||
|
||||
# Author: David Underhill
|
||||
# Script to permanently delete files/folders from your git repository. To use
|
||||
# it, cd to your repository's root and then run the script with a list of paths
|
||||
# you want to delete, e.g., git-delete-history path1 path2
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# make sure we're at the root of git repo
|
||||
if [ ! -d .git ]; then
|
||||
echo "Error: must run this script from the root of a git repository"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# remove all paths passed as arguments from the history of the repo
|
||||
files=$@
|
||||
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch $files" HEAD
|
||||
|
||||
# remove the temporary history git-filter-branch otherwise leaves behind for a long time
|
||||
rm -rf .git/refs/original/ && git reflog expire --all && git gc --aggressive --prune
|
||||
|
|
@ -39,7 +39,7 @@ declare milestone_id=$(echo "$open_milestones$closed_milestones" | sed 's/"descr
|
|||
declare tickets=$(curl -s -H "$script_user_agent" "https://api.github.com/repos/apache/incubator-pekko/issues?milestone=$milestone_id&state=all&per_page=100" | sed 's/"comments"/\n/g' | perl -ne 'm/number":([0-9]+),"title":"(.+?)",/ && print " - *$1* $2\n"' | sort -n)
|
||||
declare ticket_count=$(echo "$tickets" | wc -l | grep -o '[1-9].*')
|
||||
|
||||
echo "$tag1 compared to Akka $tag2":
|
||||
echo "$tag1 compared to Pekko $tag2":
|
||||
|
||||
echo "* $ticket_count tickets closed"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue