Skip to content

Commit 39e8d4e

Browse files
committed
chore: update JIRA automation
1 parent 7856bb9 commit 39e8d4e

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

.github/workflows/jira-issue.yml

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,59 @@ 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 }}
28+
api-base: https://jira.mongodb.org
2429
project-key: MCP
2530
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+
2938
- name: Add comment
39+
if: steps.create.outputs.issue-key
3040
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043
3141
with:
3242
issue-number: ${{ github.event.issue.number }}
3343
body: |
3444
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

Comments
 (0)