File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Jira sync
2
+
3
+ on :
4
+ issues :
5
+ types : [closed]
6
+
7
+ jobs :
8
+ jira-sync :
9
+ runs-on : ubuntu-latest
10
+
11
+ steps :
12
+ - name : Move Jira issue to Done
13
+ env :
14
+ JIRA_API_TOKEN : ${{ secrets.JIRA_API_TOKEN }}
15
+ JIRA_USERNAME : ${{ secrets.JIRA_USERNAME }}
16
+ JIRA_BASE_URL : ${{ secrets.JIRA_BASE_URL }}
17
+ run : |
18
+ issue_number=${{ github.event.issue.number }}
19
+
20
+ jira_issue_key=$(curl -s -u "${JIRA_USERNAME}:${JIRA_API_TOKEN}" \
21
+ -X GET -H "Content-Type: application/json" \
22
+ "${JIRA_BASE_URL}/rest/api/2/search?jql=summary~\"${issue_number}\"" | \
23
+ jq -r '.issues[0].key')
24
+
25
+ if [ -z "$jira_issue_key" ]; then
26
+ exit
27
+ fi
28
+
29
+ curl -s -u "${JIRA_USERNAME}:${JIRA_API_TOKEN}" \
30
+ -X POST -H "Content-Type: application/json" \
31
+ --data "{\"transition\": {\"id\": \"41\"}}" \
32
+ "${JIRA_BASE_URL}/rest/api/2/issue/${jira_issue_key}/transitions"
33
+
34
+ echo "Moved Jira issue ${jira_issue_key} to Done"
You can’t perform that action at this time.
0 commit comments