File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Create Jira Ticket for Bugs
2+
3+ on :
4+ issues :
5+ types : [labeled]
6+
7+ jobs :
8+ create-jira :
9+ if : github.event.label.name == 'bug'
10+ runs-on : ubuntu-latest
11+ steps :
12+ - name : Create Jira Issue
13+ run : |
14+ set -euo pipefail
15+
16+ # Prepare fields
17+ SUMMARY="[GitHub][Android SDK] ${{ github.event.issue.title }}"
18+ ISSUE_URL="${{ github.event.issue.html_url }}"
19+ ISSUE_BODY="${{ github.event.issue.body }}"
20+
21+ # Build JSON payload in Atlassian Document Format (ADF)
22+ JSON_PAYLOAD=$(jq -n \
23+ --arg summary "$SUMMARY" \
24+ --arg url "$ISSUE_URL" \
25+ --arg body "$ISSUE_BODY" \
26+ --arg project "${{ secrets.JIRA_PROJECT_KEY }}" \
27+ --argjson labels '${{ secrets.JIRA_LABELS }}' \
28+ '{
29+ fields: {
30+ project: { key: $project },
31+ summary: $summary,
32+ description: {
33+ type: "doc",
34+ version: 1,
35+ content: [
36+ {
37+ type: "paragraph",
38+ content: [
39+ {
40+ type: "text",
41+ text: "GitHub issue: ",
42+ marks: []
43+ },
44+ {
45+ type: "text",
46+ text: $url,
47+ marks: [{ type: "link", attrs: { href: $url } }]
48+ }
49+ ]
50+ },
51+ {
52+ type: "paragraph",
53+ content: [
54+ { type: "text", text: $body }
55+ ]
56+ }
57+ ]
58+ },
59+ issuetype: { name: "Bug" },
60+ labels: $labels
61+ }
62+ }'
63+ )
64+
65+ # Create Jira issue
66+ curl -sS -u "${{ secrets.JIRA_USERNAME }}:${{ secrets.JIRA_API_TOKEN }}" -X POST \
67+ -H "Content-Type: application/json" \
68+ --data "$JSON_PAYLOAD" \
69+ "${{ secrets.JIRA_BASE_URL }}/rest/api/3/issue"
You can’t perform that action at this time.
0 commit comments