|
| 1 | +name: Update API Commands |
| 2 | +on: |
| 3 | + schedule: |
| 4 | + - cron: 30 8 * * TUE |
| 5 | + workflow_dispatch: |
| 6 | +jobs: |
| 7 | + update-sdk: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + steps: |
| 10 | + - uses: GitHubSecurityLab/actions-permissions/monitor@v1 |
| 11 | + with: |
| 12 | + config: ${{ vars.PERMISSIONS_CONFIG }} |
| 13 | + - name: Checkout |
| 14 | + uses: actions/checkout@v4 |
| 15 | + - uses: actions/setup-go@v5 |
| 16 | + with: |
| 17 | + go-version-file: 'go.mod' |
| 18 | + - run: make update-openapi-spec |
| 19 | + - name: Verify Changed files |
| 20 | + uses: tj-actions/verify-changed-files@6b59fb7cbb8d9a6ecc10ee556496d0078a9ed957 |
| 21 | + id: verify-changed-files |
| 22 | + with: |
| 23 | + files: | |
| 24 | + ./tools/api-generator/spec.yaml |
| 25 | + - run: make gen-api-commands |
| 26 | + if: steps.verify-changed-files.outputs.files_changed == 'true' |
| 27 | + - name: Find JIRA ticket |
| 28 | + id: find |
| 29 | + if: steps.verify-changed-files.outputs.files_changed == 'true' |
| 30 | + uses: mongodb/apix-action/find-jira@d74254f04d46b8e94ef22248607d47225c8a171a |
| 31 | + with: |
| 32 | + token: ${{ secrets.JIRA_API_TOKEN }} |
| 33 | + jql: project = CLOUDP AND status NOT IN (Closed, Resolved) AND summary ~ "Update Autogenerated Commands" |
| 34 | + - name: Set JIRA ticket (find) |
| 35 | + if: (steps.verify-changed-files.outputs.files_changed == 'true') && (steps.find.outputs.found == 'true') |
| 36 | + run: | |
| 37 | + echo "JIRA_KEY=${{steps.find.outputs.issue-key}}" >> "$GITHUB_ENV" |
| 38 | + - name: Create JIRA ticket |
| 39 | + uses: mongodb/apix-action/create-jira@d74254f04d46b8e94ef22248607d47225c8a171a |
| 40 | + id: create |
| 41 | + if: (steps.verify-changed-files.outputs.files_changed == 'true') && (steps.find.outputs.found == 'false') |
| 42 | + with: |
| 43 | + token: ${{ secrets.JIRA_API_TOKEN }} |
| 44 | + project-key: CLOUDP |
| 45 | + summary: "[AtlasCLI] Update Autogenerated Commands" |
| 46 | + issuetype: Story |
| 47 | + description: Update Autogenerated Commands |
| 48 | + components: AtlasCLI |
| 49 | + extra-data: | |
| 50 | + { |
| 51 | + "fields": { |
| 52 | + "assignee": { |
| 53 | + "name": "cloud-atlascli-escalation" |
| 54 | + }, |
| 55 | + "customfield_12751": [ |
| 56 | + { |
| 57 | + "id": "22223" |
| 58 | + } |
| 59 | + ] |
| 60 | + } |
| 61 | + } |
| 62 | + - name: Set JIRA ticket (create) |
| 63 | + if: (steps.verify-changed-files.outputs.files_changed == 'true') && (steps.find.outputs.found == 'false') |
| 64 | + run: | |
| 65 | + echo "JIRA_KEY=${{steps.create.outputs.issue-key}}" >> "$GITHUB_ENV" |
| 66 | + - name: set Apix Bot token |
| 67 | + if: steps.verify-changed-files.outputs.files_changed == 'true' |
| 68 | + id: app-token |
| 69 | + uses: mongodb/apix-action/token@d74254f04d46b8e94ef22248607d47225c8a171a |
| 70 | + with: |
| 71 | + app-id: ${{ secrets.APIXBOT_APP_ID }} |
| 72 | + private-key: ${{ secrets.APIXBOT_APP_PEM }} |
| 73 | + - uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f |
| 74 | + id: pr |
| 75 | + if: steps.verify-changed-files.outputs.files_changed == 'true' |
| 76 | + with: |
| 77 | + token: ${{ steps.app-token.outputs.token }} |
| 78 | + title: "${{ env.JIRA_KEY }}: Update Autogenerated Commands" |
| 79 | + commit-message: "${{ env.JIRA_KEY }}: Update Autogenerated Commands" |
| 80 | + delete-branch: true |
| 81 | + base: master |
| 82 | + branch: ${{ env.JIRA_KEY }} |
| 83 | + labels: | |
| 84 | + dependencies |
| 85 | + go |
| 86 | + body: | |
| 87 | + ## Proposed changes |
| 88 | + Update Autogenerated Commands |
| 89 | + _Jira ticket:_ ${{ env.JIRA_KEY }} |
0 commit comments