Skip to content

Commit b82af9b

Browse files
blvafmenezes
andauthored
chore: update JIRA automation (#387)
Co-authored-by: Filipe Constantinov Menezes <[email protected]>
1 parent fdea0df commit b82af9b

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

.github/workflows/jira-issue.yml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,56 @@ name: Create JIRA ticket for new issues
33

44
on:
55
issues:
6-
types: [opened]
6+
types: [opened, labeled]
77

88
permissions:
99
issues: write
1010
contents: read
11+
1112
jobs:
1213
jira_task:
1314
name: Create Jira issue
1415
runs-on: ubuntu-latest
16+
if: github.event.action == 'opened' || github.event.label.name == 'create-jira'
1517
steps:
1618
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
1719
with:
1820
config: ${{ vars.PERMISSIONS_CONFIG }}
21+
1922
- name: Create JIRA ticket
2023
uses: mongodb/apix-action/create-jira@v8
2124
id: create
25+
continue-on-error: true
2226
with:
2327
token: ${{ secrets.JIRA_API_TOKEN }}
2428
project-key: MCP
2529
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+
2936
- name: Add comment
3037
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043
3138
with:
3239
issue-number: ${{ github.event.issue.number }}
3340
body: |
3441
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

Comments
 (0)