.github/workflows/bump_versions.yml #920
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
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 | |
pull-requests: write # to create pull request | |
runs-on: ubuntu-latest | |
steps: | |
- id: set-versions | |
name: Load latest SDK versions | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{secrets.GITHUB_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 releases = await github.rest.repos.listReleases({ | |
owner: 'DataDog', | |
repo: repo | |
}) | |
return {client: repo, version: releases.data[0]["tag_name"]} | |
})) | |
console.log(versions) | |
return JSON.stringify(versions) | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Write version | |
run: |- | |
echo '${{steps.set-versions.outputs.result}}' | jq > ./data/sdk_versions.json | |
git add ./data/sdk_versions.json | |
git config user.name packages | |
git config user.email [email protected] | |
git add . | |
git commit -m "Bump SDK" | |
git push -f origin HEAD:refs/heads/sdk/versions | |
- uses: actions/github-script@v7 | |
name: Propose change with latest versions | |
with: | |
github-token: ${{secrets.GITHUB_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 | |
}) |