summaryrefslogtreecommitdiffstats
path: root/.travis/labeler.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2018-12-28 14:38:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2018-12-28 14:38:58 +0000
commitfa4ece01aed54c9a146af868be0d3db611ded229 (patch)
tree319cffc5f6c2abd7cce514383716153469fc6295 /.travis/labeler.sh
parentNew upstream version 1.11.0+dfsg (diff)
downloadnetdata-fa4ece01aed54c9a146af868be0d3db611ded229.tar.xz
netdata-fa4ece01aed54c9a146af868be0d3db611ded229.zip
New upstream version 1.11.1+dfsgupstream/1.11.1+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x.travis/labeler.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/.travis/labeler.sh b/.travis/labeler.sh
new file mode 100755
index 000000000..47bf250a0
--- /dev/null
+++ b/.travis/labeler.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+# This is a simple script which should apply labels to unlabelled issues from last 3 days.
+# It will soon be deprecated by GitHub Actions so no futher development on it is planned.
+
+if [ "$GITHUB_TOKEN" == "" ]; then
+ echo "GITHUB_TOKEN is needed"
+ exit 1
+fi
+
+# Download hub
+HUB_VERSION=${HUB_VERSION:-"2.5.1"}
+wget "https://github.com/github/hub/releases/download/v${HUB_VERSION}/hub-linux-amd64-${HUB_VERSION}.tgz" -O "/tmp/hub-linux-amd64-${HUB_VERSION}.tgz"
+tar -C /tmp -xvf "/tmp/hub-linux-amd64-${HUB_VERSION}.tgz" &>/dev/null
+export PATH=$PATH:"/tmp/hub-linux-amd64-${HUB_VERSION}/bin"
+
+echo "Looking up available labels"
+LABELS_FILE=/tmp/exclude_labels
+hub issue labels > $LABELS_FILE
+
+for STATE in "open" "closed"; do
+ for ISSUE in $(hub issue -f "%I %l%n" -s "$STATE" -d "$(date +%F -d '3 days ago')" | grep -v -f $LABELS_FILE); do
+ echo "Processing $STATE issue no. $ISSUE"
+ URL="https://api.github.com/repos/netdata/netdata/issues/$ISSUE"
+ BODY="$(curl "${URL}" | jq .body 2>/dev/null)"
+ case "${BODY}" in
+ *"# Question summary"* ) curl -H "Authorization: token $GITHUB_TOKEN" -d '{"labels":["question"]}' -X PATCH "${URL}" ;;
+ *"# Bug report summary"* ) curl -H "Authorization: token $GITHUB_TOKEN" -d '{"labels":["bug"]}' -X PATCH "${URL}" ;;
+ * ) curl -H "Authorization: token $GITHUB_TOKEN" -d '{"labels":["needs triage"]}' -X PATCH "${URL}" ;;
+ esac
+ done
+done