20
20
run : echo "VERSION=$(curl -sSfL -X GET https://api.github.com/repos/mongodb/atlas-sdk-go/releases/latest | jq -r '.tag_name')" >> "$GITHUB_OUTPUT"
21
21
- run : make update-atlas-sdk
22
22
- name : Verify Changed files
23
- uses : tj-actions/verify-changed-files@530d86d0a237225c87beaa000750988f8965ee31
23
+ uses : tj-actions/verify-changed-files@v20.0.1
24
24
id : verify-changed-files
25
25
with :
26
26
files : |
@@ -30,79 +30,64 @@ jobs:
30
30
- name : Find JIRA ticket
31
31
id : find
32
32
if : steps.verify-changed-files.outputs.files_changed == 'true'
33
- shell : bash
34
- env :
35
- VERSION : ${{ steps.version.outputs.VERSION }}
36
- JIRA_API_TOKEN : ${{ secrets.JIRA_API_TOKEN }}
33
+ uses : mongodb/apix-action/find-jira@v4
34
+ with :
35
+ token : ${{ secrets.JIRA_API_TOKEN }}
36
+ jql : project = CLOUDP and summary ~ "Bump Atlas GO SDK to '${{ steps.version.outputs.VERSION }}'"
37
+ - name : Set JIRA ticket (find)
38
+ if : (steps.verify-changed-files.outputs.files_changed == 'true') && (steps.find.outputs.found == 'true')
37
39
run : |
38
- json_response=$(curl --request POST \
39
- --url 'https://jira.mongodb.org/rest/api/2/search' \
40
- --header 'Authorization: Bearer '"${JIRA_API_TOKEN}" \
41
- --header 'Accept: application/json' \
42
- --header 'Content-Type: application/json' \
43
- --data '{
44
- "jql": "project = CLOUDP and summary ~ \"Bump Atlas GO SDK to '"${VERSION}"'\""
45
- }')
46
- echo "Response: ${json_response}"
47
- echo "FOUND=$(echo "${json_response}" | jq -c '[.issues] | flatten | any')" >> "$GITHUB_OUTPUT"
40
+ echo "JIRA_KEY=${{steps.find.outputs.issue-key}}" >> "$GITHUB_ENV"
48
41
- name : Create JIRA ticket
42
+ uses : mongodb/apix-action/create-jira@v4
49
43
id : create
50
- if : steps.verify-changed-files.outputs.files_changed == 'true' && steps.find.outputs.FOUND == 'false'
51
- shell : bash
52
- env :
53
- VERSION : ${{ steps.version.outputs.VERSION }}
54
- JIRA_API_TOKEN : ${{ secrets.JIRA_API_TOKEN }}
55
- JIRA_ASSIGNEE : ${{ secrets.ASSIGNEE_JIRA_TICKET }}
56
- run : |
57
- json_response=$(curl --request POST \
58
- --url 'https://jira.mongodb.org/rest/api/2/issue' \
59
- --header 'Authorization: Bearer '"${JIRA_API_TOKEN}" \
60
- --header 'Accept: application/json' \
61
- --header 'Content-Type: application/json' \
62
- --data '{
44
+ if : (steps.verify-changed-files.outputs.files_changed == 'true') && (steps.find.outputs.found == 'false')
45
+ with :
46
+ token : ${{ secrets.JIRA_API_TOKEN }}
47
+ project-key : CLOUDP
48
+ summary : Bump Atlas GO SDK to '${{ steps.version.outputs.VERSION }}'
49
+ issuetype : Story
50
+ description : Update Atlas GO SDK to '${{ steps.version.outputs.VERSION }}'
51
+ components : AtlasCLI
52
+ extra-data : |
53
+ {
63
54
"fields": {
64
- "project": {
65
- "id": "10984"
66
- },
67
- "summary": "Bump Atlas GO SDK to '"${VERSION}"'",
68
- "issuetype": {
69
- "id": "12"
70
- },
71
- "customfield_12751": [{
72
- "id": "22223"
73
- }],
74
- "description": "Update Atlas GO SDK to '"${VERSION}"'.",
75
- "components": [
76
- {
77
- "id": "30450"
78
- }
79
- ],
80
- "assignee": {
81
- "name": "'"${JIRA_ASSIGNEE}"'"
55
+ "assignee": {
56
+ "name": "cloud-atlascli-escalation"
57
+ },
58
+ "customfield_12751": [
59
+ {
60
+ "id": "22223"
82
61
}
62
+ ]
83
63
}
84
- }')
85
-
86
- echo "Response : ${json_response}"
87
-
88
- JIRA_TICKET_ID=$(echo "${json_response}" | jq -r '.key')
89
-
90
- echo "The following JIRA ticket has been created : ${JIRA_TICKET_ID}"
91
- echo "jira-ticket-id=${JIRA_TICKET_ID}" >> "${GITHUB_OUTPUT}"
64
+ }
65
+ - name : Set JIRA ticket (create)
66
+ if : (steps.verify-changed-files.outputs.files_changed == 'true') && (steps.find.outputs.found == 'false')
67
+ run : |
68
+ echo "JIRA_KEY=${{steps.create.outputs.issue-key}}" >> "$GITHUB_ENV"
69
+ - name : set Apix Bot token
70
+ if : steps.verify-changed-files.outputs.files_changed == 'true'
71
+ id : app-token
72
+ uses : mongodb/apix-action/token@v4
73
+ with :
74
+ app-id : ${{ secrets.APIXBOT_APP_ID }}
75
+ private-key : ${{ secrets.APIXBOT_APP_PEM }}
92
76
- uses : peter-evans/create-pull-request@v7
93
77
id : pr
94
- if : steps.verify-changed-files.outputs.files_changed == 'true' && steps.find.outputs.FOUND == 'false'
78
+ if : steps.verify-changed-files.outputs.files_changed == 'true'
95
79
with :
96
- title : " ${{ steps.create.outputs.jira-ticket-id }}: Bump Atlas GO SDK to ${{ steps.version.outputs.VERSION }}"
97
- commit-message : " ${{ steps.create.outputs.jira-ticket-id }}: Bump Atlas GO SDK to ${{ steps.version.outputs.VERSION }}"
80
+ token : ${{ steps.app-token.outputs.token }}
81
+ title : " ${{ env.JIRA_KEY }}: Bump Atlas GO SDK to ${{ steps.version.outputs.VERSION }}"
82
+ commit-message : " ${{ env.JIRA_KEY }}: Bump Atlas GO SDK to ${{ steps.version.outputs.VERSION }}"
98
83
delete-branch : true
99
84
base : master
100
- branch : ${{ steps.create.outputs.jira-ticket-id }}
85
+ branch : ${{ env.JIRA_KEY }}
101
86
labels : |
102
87
dependencies
103
88
go
104
89
atlas-sdk
105
90
body : |
106
91
## Proposed changes
107
92
Update MongoDB Atlas Go Client SDK to ${{ steps.version.outputs.VERSION }}
108
- _Jira ticket:_ ${{ steps.create.outputs.jira-ticket-id }}
93
+ _Jira ticket:_ ${{ env.JIRA_KEY }}
0 commit comments