Skip to content

Update API Commands

Update API Commands #6

name: Update API Commands
on:
schedule:
- cron: 30 8 * * TUE
workflow_dispatch:
jobs:
update-api:
runs-on: ubuntu-latest
steps:
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
with:
config: ${{ vars.PERMISSIONS_CONFIG }}
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- run: make update-openapi-spec
- name: Verify Changed files
uses: tj-actions/verify-changed-files@6b59fb7cbb8d9a6ecc10ee556496d0078a9ed957
id: verify-changed-files
with:
files: |
./tools/api-generator/spec.yaml
- run: make gen-api-commands
if: steps.verify-changed-files.outputs.files_changed == 'true'
- run: make gen-docs
if: steps.verify-changed-files.outputs.files_changed == 'true'
- name: Find JIRA ticket
id: find
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: mongodb/apix-action/find-jira@d74254f04d46b8e94ef22248607d47225c8a171a
with:
token: ${{ secrets.JIRA_API_TOKEN }}
jql: project = CLOUDP AND status NOT IN (Closed, Resolved) AND summary ~ "Update Autogenerated Commands"
- name: Set JIRA ticket (find)
if: (steps.verify-changed-files.outputs.files_changed == 'true') && (steps.find.outputs.found == 'true')
run: |
echo "JIRA_KEY=${{steps.find.outputs.issue-key}}" >> "$GITHUB_ENV"
- name: Create JIRA ticket
uses: mongodb/apix-action/create-jira@d74254f04d46b8e94ef22248607d47225c8a171a
id: create
if: (steps.verify-changed-files.outputs.files_changed == 'true') && (steps.find.outputs.found == 'false')
with:
token: ${{ secrets.JIRA_API_TOKEN }}
project-key: CLOUDP
summary: "[AtlasCLI] Update Autogenerated Commands"
issuetype: Story
description: Update Autogenerated Commands
components: AtlasCLI
extra-data: |
{
"fields": {
"assignee": {
"name": "cloud-atlascli-escalation"
},
"customfield_12751": [
{
"id": "22223"
}
]
}
}
- name: Set JIRA ticket (create)
if: (steps.verify-changed-files.outputs.files_changed == 'true') && (steps.find.outputs.found == 'false')
run: |
echo "JIRA_KEY=${{steps.create.outputs.issue-key}}" >> "$GITHUB_ENV"
- name: set Apix Bot token
if: steps.verify-changed-files.outputs.files_changed == 'true'
id: app-token
uses: mongodb/apix-action/token@d74254f04d46b8e94ef22248607d47225c8a171a
with:
app-id: ${{ secrets.APIXBOT_APP_ID }}
private-key: ${{ secrets.APIXBOT_APP_PEM }}
- uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f
id: pr
if: steps.verify-changed-files.outputs.files_changed == 'true'
with:
token: ${{ steps.app-token.outputs.token }}
title: "${{ env.JIRA_KEY }}: Update Autogenerated Commands"
commit-message: "${{ env.JIRA_KEY }}: Update Autogenerated Commands"
delete-branch: true
base: master
branch: ${{ env.JIRA_KEY }}
labels: |
dependencies
go
body: |
## Proposed changes
Update Autogenerated Commands
_Jira ticket:_ ${{ env.JIRA_KEY }}