forked from dougwaldron/jira-issues-importer
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
81d01af
commit 0cac652
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
USER="<your-jenkins-username" | ||
PWD="<your-jenkins-pwd>" | ||
JIRA="https://issues.jenkins.io" | ||
GITHUB="https://github.com/jenkins-infra/helpdesk/issues/" | ||
FILE="jira-keys-to-github-id.txt" # with each line containing <JENKINS-ISSUE-KEY>:<GITHUB-ISSUE-KEY>, ex: "INFRA-545:415" | ||
|
||
while IFS=':' read -ra ADDR; do | ||
echo "processing:: $GITHUB${ADDR[1]} >> ${JIRA}/browse/${ADDR[0]}" | ||
ID=${ADDR[1]} | ||
KEY=${ADDR[0]} | ||
BODY="For your information, [all INFRA issues|${JIRA}/projects/INFRA/issues/] related to the [Jenkins Infrastructure project|https://www.jenkins.io/projects/infrastructure/] have been transferred to Github: ${GITHUB}\n\nHere is the direct link to this issue in Github: ${GITHUB}/${ID}\nAnd here is the link to a search for related issues: ${GITHUB}?q=%22${KEY}%22\n\n(Note: this is an automated bulk comment)" | ||
# https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/#adding-a-comment | ||
curl \ | ||
-D- \ | ||
-u ${USER}:${PWD} \ | ||
-X POST \ | ||
--data "{\"body\": \"${BODY}\"}" \ | ||
-H "Content-Type: application/json" \ | ||
"${JIRA}/rest/api/2/issue/${KEY}/comment" | ||
|
||
done <${FILE} |