Skip to content

Update SDK

Update SDK #130

name: Update SDK
on:
schedule:
- cron: 30 8 * * TUE
workflow_dispatch:
jobs:
update-sdk:
runs-on: ubuntu-latest
steps:
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
with:
config: ${{ vars.PERMISSIONS_CONFIG }}
- name: Checkout
uses: actions/checkout@v5
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- id: version
run: echo "VERSION=$(curl -sSfL -X GET https://api.github.com/repos/mongodb/atlas-sdk-go/releases/latest | jq -r '.tag_name')" >> "$GITHUB_OUTPUT"
- run: make update-atlas-sdk
- name: Verify Changed files
uses: tj-actions/verify-changed-files@a1c6acee9df209257a246f2cc6ae8cb6581c1edf
id: verify-changed-files
with:
files: |
./internal/**/*
go.mod
go.sum
- run: make gen-purls
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@6c3fde402c21942fa46cde003f190c2b23c59530
with:
token: ${{ secrets.JIRA_API_TOKEN }}
jql: project = CLOUDP and summary ~ "Bump Atlas GO SDK to '${{ steps.version.outputs.VERSION }}'"
- 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@6c3fde402c21942fa46cde003f190c2b23c59530
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: Bump Atlas GO SDK to '${{ steps.version.outputs.VERSION }}'
issuetype: Story
description: Update Atlas GO SDK to '${{ steps.version.outputs.VERSION }}'
components: AtlasCLI
assignee: ${{ secrets.ASSIGNEE_JIRA_TICKET }}
extra-data: |
{
"fields": {
"fixVersions": [
{
"name": "next-atlascli-release"
}
],
"customfield_12751": [
{
"id": "22223"
}
],
"customfield_10257": {
"id": "11861"
}
}
}
- 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@6c3fde402c21942fa46cde003f190c2b23c59530
with:
app-id: ${{ secrets.APIXBOT_APP_ID }}
private-key: ${{ secrets.APIXBOT_APP_PEM }}
- uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e
id: pr
if: steps.verify-changed-files.outputs.files_changed == 'true'
with:
token: ${{ steps.app-token.outputs.token }}
committer: "${{ steps.app-token.outputs.user-name }} <${{ steps.app-token.outputs.user-email }}>"
author: "${{ steps.app-token.outputs.user-name }} <${{ steps.app-token.outputs.user-email }}>"
title: "${{ env.JIRA_KEY }}: Bump Atlas GO SDK to ${{ steps.version.outputs.VERSION }}"
commit-message: "${{ env.JIRA_KEY }}: Bump Atlas GO SDK to ${{ steps.version.outputs.VERSION }}"
delete-branch: true
base: master
branch: ${{ env.JIRA_KEY }}
labels: |
dependencies
go
atlas-sdk
auto_close_jira
body: |
## Proposed changes
Update MongoDB Atlas Go Client SDK to ${{ steps.version.outputs.VERSION }}
_Jira ticket:_ ${{ env.JIRA_KEY }}
Note: Jira ticket will be closed automatically when this PR is merged.
- name: Set auto merge
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
gh pr merge "${{ steps.pr.outputs.pull-request-url }}" --auto --squash