Created
July 12, 2012 15:33
-
-
Save prenagha/3098888 to your computer and use it in GitHub Desktop.
JIRA Bulk Unwatch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Bulk Unwatch | |
# JIRA doesn't support unwatch from the bulk change action | |
# This script fills the gap | |
# Known to work with JIRA 5 via the REST API | |
# | |
# 1. Using JIRA, Issue Navigator, write a query to get all | |
# the issues you want to unwatch. Something like | |
# "issue in watchedIssues() AND status != Closed" | |
# works well as a starting point. | |
# 2. Using the View menu, Right-Click on RSS and save the RSS | |
# output to your computer. | |
# 3. Run this script against the RSS file you downloaded | |
# ./bulkUnwatch.sh <JIRA USERID> <JIRA PASSWORD> <RSS FILE> | |
# | |
USERID=$1 | |
PASSWORD=$2 | |
RSS=$3 | |
if [ -z "$USERID" -o -z "$PASSWORD" -o ! -f "$RSS" ] | |
then | |
echo "bulkUnwatch.sh <JIRA USERID> <JIRA PASSWORD> <RSS FILE>" | |
exit 1 | |
fi | |
for URLBASE in `cat $RSS | fgrep "<link>" | fgrep "/jira/browse/" | sed 's/<link>//' | sed 's/<\/link>//' | sed 's/browse/rest\/api\/latest\/issue/'` | |
do | |
# 204 response on success | |
URL="${URLBASE}/watchers?username=${USERID}" | |
curl --request DELETE \ | |
--write-out "%{http_code}\n" \ | |
--header "Accept: application/json" \ | |
--header "Content-Type: application/json" \ | |
--user "${USERID}:${PASSWORD}" \ | |
$URL | |
done | |
exit 0 |
Well done, thanks
Do you just run this script in Mac terminal? do you need any particular software installed?
@benjambe Thanks so much for posting that comment!
Today it is possible to just unwatch issues using bulk operations.
So just use the query as described above:
issue in watchedIssues()
And select bulk change.
This was my version, no script needed.
watcher = currentUser() AND resolution = Unresolved AND assignee != currentUser() ORDER BY priority DESC, updated DESC
This was my version, no script needed.
watcher = currentUser() AND resolution = Unresolved AND assignee != currentUser() ORDER BY priority DESC, updated DESC
This works 100% thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Padraic,
Just forked your script and pushed a change to fgrep "/browse/" instead of "/jira/browse/" as for example our JIRA at work doesn't have /jira/ in the URLs.
Totally new to Gist.
Is there such a thing as pull requests here?