Skip to content

Commit

Permalink
fix: add sdk autoupdates (#1557)
Browse files Browse the repository at this point in the history
* fix: add sdk autoupdates

* fix: commit and message

* fix: make commit lint happy

* Update .github/workflows/update-sdk.yml

* Update scripts/update-sdk.sh
  • Loading branch information
wtrocki authored Oct 24, 2023
1 parent 62b84a6 commit 1f16650
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/update-sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Update SDK
on:
schedule:
- cron: 30 8 * * TUE
workflow_dispatch:

jobs:
update-sdk:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: update
run: |
go install github.com/icholy/gomajor@latest
make update-atlas-sdk
- name: Verify Changed files
uses: tj-actions/verify-changed-files@78dc414e915e0664bcf0d2b42465a86cd47bcc3c
id: verify-changed-files
with:
files: |
./internal/**/*
- uses: peter-evans/create-pull-request@v5
if: steps.verify-changed-files.outputs.files_changed == 'true'

with:
title: "chore: atlas GO sdk update"
commit-message: "build(deps): bump go.mongodb.org/atlas-sdk"
delete-branch: true
branch: atlas-sdk-update
body: |
Automatic update for MongoDB Atlas Go Client SDK
4 changes: 1 addition & 3 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,4 @@ link-git-hooks: ## Install git hooks

.PHONY: update-atlas-sdk
update-atlas-sdk: ## Update the atlas-sdk dependency
go install github.com/icholy/[email protected]
## Fetch the latest major version and update imports.
gomajor get go.mongodb.org/atlas-sdk/v20231001001@latest
./scripts/update-sdk.sh
9 changes: 9 additions & 0 deletions scripts/update-sdk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

set -euo pipefail

LATEST_SDK_RELEASE=$(curl -sSfL -X GET https://api.github.com/repos/mongodb/atlas-sdk-go/releases/latest | jq -r '.tag_name' | cut -d '.' -f 1)
echo "==> Updating SDK to latest major version $LATEST_SDK_RELEASE"
gomajor get "go.mongodb.org/atlas-sdk/$LATEST_SDK_RELEASE@latest"
go mod tidy
echo "Finished update"

0 comments on commit 1f16650

Please sign in to comment.