CLOUDP-284685 Create SDK PRs via apix-bot #84
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update SDK | |
on: | |
schedule: | |
- cron: 30 8 * * TUE | |
workflow_dispatch: | |
pull_request: # TODO: remove | |
jobs: | |
update-sdk: | |
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: go install github.com/icholy/gomajor@latest | |
- 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/[email protected] | |
id: verify-changed-files | |
with: | |
files: | | |
./internal/**/* | |
go.mod | |
go.sum | |
- name: Find JIRA ticket | |
id: find | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
uses: mongodb/apix-action/find-jira@v3 | |
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@v3 | |
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 | |
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@v3 | |
with: | |
app-id: ${{ secrets.APIXBOT_APP_ID }} | |
private-key: ${{ secrets.APIXBOT_APP_PEM }} | |
- uses: peter-evans/create-pull-request@v7 | |
id: pr | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
with: | |
token: ${{ steps.app-token.outputs.token }} | |
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 | |
body: | | |
## Proposed changes | |
Update MongoDB Atlas Go Client SDK to ${{ steps.version.outputs.VERSION }} | |
_Jira ticket:_ ${{ env.JIRA_KEY }} |