Skip to content

.github/workflows/bump_versions.yml #1243

.github/workflows/bump_versions.yml

.github/workflows/bump_versions.yml #1243

Workflow file for this run

on:
schedule:
# At 08:00 on every day-of-week from Monday through Friday.
- cron: "0 8 * * 1-5"
permissions: {}
jobs:
sdk-versions:
permissions:
contents: write # for git push
id-token: write # Needed to federate tokens.
runs-on: ubuntu-latest
steps:
- uses: DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3
id: octo-sts
with:
scope: DataDog/documentation
policy: self.bump-versions.create-pr
- id: set-versions
name: Load latest SDK versions
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
github-token: ${{ steps.octo-sts.outputs.token }}
result-encoding: string
script: |
const clients = [
'datadog-api-client-go',
'datadog-api-client-java',
'datadog-api-client-python',
'datadog-api-client-ruby',
'datadog-api-client-typescript',
'datadog-api-client-rust',
'integrations-core'
]
const versions = await Promise.all(clients.map(async (repo) => {
const release = await github.rest.repos.getLatestRelease({
owner: 'DataDog',
repo: repo
})
return {client: repo, version: release.data["tag_name"]}
}))
console.log(versions)
return JSON.stringify(versions, null, 2)
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
with:
persist-credentials: true
- name: Write version
run: |-
mkdir -p ./data
echo '${{steps.set-versions.outputs.result}}' > ./data/sdk_versions.json
git add ./data/sdk_versions.json
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Bump SDK"
git push -f origin HEAD:refs/heads/sdk/versions
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
name: Propose change with latest versions
with:
github-token: ${{ steps.octo-sts.outputs.token }}
result-encoding: string
script: |
await github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: "[SDK] new versions are available",
body: "SSID",
head: "sdk/versions",
base: "master",
maintainer_can_modify: true
})