@@ -3,32 +3,56 @@ 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 }}
24
28
project-key : MCP
25
29
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
30
+ issuetype : Bug
31
+
32
+ - name : Show result
33
+ run : |
34
+ echo "JIRA action result: ${{ steps.create.outputs.issue-key || 'FAILED' }}"
35
+
29
36
- name : Add comment
30
37
uses : peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043
31
38
with :
32
39
issue-number : ${{ github.event.issue.number }}
33
40
body : |
34
41
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.
42
+
43
+ - name : Remove create-jira label
44
+ if : github.event.action == 'labeled' && github.event.label.name == 'create-jira'
45
+ uses : actions/github-script@v7
46
+ with :
47
+ script : |
48
+ try {
49
+ await github.rest.issues.removeLabel({
50
+ owner: context.repo.owner,
51
+ repo: context.repo.repo,
52
+ issue_number: context.issue.number,
53
+ name: 'create-jira'
54
+ });
55
+ console.log('✅ Removed create-jira label');
56
+ } catch (error) {
57
+ console.log('⚠️ Could not remove create-jira label:', error.message);
58
+ }
0 commit comments