Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Maintained by the MongoDB Atlas CLI team
* @mongodb/apix-2
* @mongodb/apix-devtools

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drive-by


# Docs maintained by Docs Cloud Team
/docs/ @mongodb/docs-cloud-team
2 changes: 0 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ updates:
schedule:
interval: weekly
day: monday
reviewers:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- "mongodb/apix-2"
129 changes: 129 additions & 0 deletions .github/workflows/jira-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@

---
# This workflow automatically creates JIRA tickets when GitHub issues are opened,
# closes JIRA tickets when GitHub issues are closed, and reopens JIRA tickets
# when GitHub issues are reopened.
#
# Required secrets:
# - JIRA_API_TOKEN: Your JIRA API token
#
name: Create and close JIRA tickets for GitHub issues

on:
issues:
types: [opened, closed, reopened]

permissions:
issues: write
contents: read

jobs:
open_jira_task:
name: Create Jira issue
runs-on: ubuntu-latest
if: github.event.action == 'opened'
steps:
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
with:
config: ${{ vars.PERMISSIONS_CONFIG }}
- name: Create JIRA ticket
uses: mongodb/apix-action/create-jira@v13
id: create
with:
token: ${{ secrets.JIRA_API_TOKEN }}
project-key: CLOUDP
summary: "HELP: GitHub Issue n. ${{ github.event.issue.number }}"
issuetype: Story
description: "This ticket tracks the following GitHub issue: ${{ github.event.issue.html_url }}."
components: AtlasCLI
assignee: ${{ vars.ASSIGNEE_JIRA_TICKET }}
extra-data: |
{
"fields": {
"fixVersions": [
{
"name": "Not Applicable"
}
],
"customfield_12751": [
{
"id": "22223"
}
],
"customfield_10257": {
"id": "11861"
Comment thread
Luke-Sanderson marked this conversation as resolved.
}
}
}
- name: Add comment
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9
with:
issue-number: ${{ github.event.issue.number }}
body: |
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.

close_jira_task:
name: Close Jira issue
runs-on: ubuntu-latest
if: github.event.action == 'closed'
steps:
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
with:
config: ${{ vars.PERMISSIONS_CONFIG }}

- name: Find JIRA ticket by GitHub issue number
id: find_jira
uses: mongodb/apix-action/find-jira@v13
with:
token: ${{ secrets.JIRA_API_TOKEN }}
jql: "project = CLOUDP AND description ~ '${{ github.event.issue.html_url }}'"

- name: Close JIRA ticket
if: steps.find_jira.outputs.found == 'true'
uses: mongodb/apix-action/transition-jira@v13
id: close_jira_ticket
continue-on-error: true
with:
token: ${{ secrets.JIRA_API_TOKEN }}
issue-key: ${{ steps.find_jira.outputs.issue-key }}
transition-id: 1381 # Resolved
- name: Add closure comment
if: steps.close_jira_ticket.outcome == 'success'
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9
with:
issue-number: ${{ github.event.issue.number }}
body: |
The corresponding JIRA ticket has been automatically closed.

reopen_jira_task:
name: Reopen Jira issue
runs-on: ubuntu-latest
if: github.event.action == 'reopened'
steps:
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
with:
config: ${{ vars.PERMISSIONS_CONFIG }}

- name: Find JIRA ticket by GitHub issue number
id: find_jira
uses: mongodb/apix-action/find-jira@v13
with:
token: ${{ secrets.JIRA_API_TOKEN }}
jql: "project = CLOUDP AND description ~ '${{ github.event.issue.html_url }}'"

- name: Reopen JIRA ticket
if: steps.find_jira.outputs.found == 'true'
uses: mongodb/apix-action/transition-jira@v13
id: reopen_jira_ticket
continue-on-error: true
with:
token: ${{ secrets.JIRA_API_TOKEN }}
issue-key: ${{ steps.find_jira.outputs.issue-key }}
transition-id: 1351 # Reopened
- name: Add reopen comment
if: steps.reopen_jira_ticket.outcome == 'success'
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9
with:
issue-number: ${{ github.event.issue.number }}
body: |
The corresponding JIRA ticket has been automatically reopened for internal tracking.
Loading