@@ -3,32 +3,59 @@ name: Create JIRA ticket for new issues
3
3
4
4
on :
5
5
issues :
6
- types : [opened]
6
+ types : [opened, labeled ]
7
7
8
8
permissions :
9
9
issues : write
10
10
contents : read
11
+
11
12
jobs :
12
13
jira_task :
13
14
name : Create Jira issue
14
15
runs-on : ubuntu-latest
16
+ if : github.event.action == 'opened' || github.event.label.name == 'create-jira'
15
17
steps :
16
18
- uses : GitHubSecurityLab/actions-permissions/monitor@v1
17
19
with :
18
20
config : ${{ vars.PERMISSIONS_CONFIG }}
21
+
19
22
- name : Create JIRA ticket
20
23
uses : mongodb/apix-action/create-jira@v8
21
24
id : create
25
+ continue-on-error : true
22
26
with :
23
27
token : ${{ secrets.JIRA_API_TOKEN }}
28
+ api-base : https://jira.mongodb.org
24
29
project-key : MCP
25
30
summary : " HELP: GitHub Issue n. ${{ github.event.issue.number }}"
26
- issuetype : Story
27
- description : " This ticket tracks the following GitHub issue: ${{ github.event.issue.html_url }}."
28
- components : MCP
31
+ issuetype : Task
32
+
33
+ - name : Show result
34
+ run : |
35
+ echo "JIRA action result: ${{ steps.create.outputs.issue-key || 'FAILED' }}"
36
+ echo "Exit code: ${{ steps.create.outcome }}"
37
+
29
38
- name : Add comment
39
+ if : steps.create.outputs.issue-key
30
40
uses : peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043
31
41
with :
32
42
issue-number : ${{ github.event.issue.number }}
33
43
body : |
34
44
Thanks for opening this issue. The ticket [${{ steps.create.outputs.issue-key }}](https://jira.mongodb.org/browse/${{ steps.create.outputs.issue-key }}) was created for internal tracking.
45
+
46
+ - name : Remove create-jira label
47
+ if : github.event.action == 'labeled' && github.event.label.name == 'create-jira'
48
+ uses : actions/github-script@v7
49
+ with :
50
+ script : |
51
+ try {
52
+ await github.rest.issues.removeLabel({
53
+ owner: context.repo.owner,
54
+ repo: context.repo.repo,
55
+ issue_number: context.issue.number,
56
+ name: 'create-jira'
57
+ });
58
+ console.log('✅ Removed create-jira label');
59
+ } catch (error) {
60
+ console.log('⚠️ Could not remove create-jira label:', error.message);
61
+ }
0 commit comments