From f62db212364497cab219e3e5f416b3e0eeef728f Mon Sep 17 00:00:00 2001 From: hestonhoffman Date: Wed, 24 Jul 2024 15:12:48 -0700 Subject: [PATCH] Testing find latest synthetics-worker tag --- .../bump_synthetics_worker_version.yml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/bump_synthetics_worker_version.yml diff --git a/.github/workflows/bump_synthetics_worker_version.yml b/.github/workflows/bump_synthetics_worker_version.yml new file mode 100644 index 0000000000000..0649058a8e851 --- /dev/null +++ b/.github/workflows/bump_synthetics_worker_version.yml @@ -0,0 +1,36 @@ +on: + push: + branches: [DOCS-8410-workflow] + # schedule: + # # At 08:00 on every day-of-week from Monday through Friday. + # - cron: '0 8 * * 1-5' + +permissions: {} +jobs: + synthetics-worker-version: + permissions: + contents: write # for git push + pull-requests: write # to create pull request + runs-on: ubuntu-latest + steps: + - name: Generate a token + id: generate-token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ vars.DOCS_GH_APP_ID }} + private-key: ${{ secrets.DOCS_GH_APP_PRIVATE_KEY }} + - id: set-worker-version + name: Load latest worker version + uses: actions/github-script@v7 + with: + github-token: ${{ steps.generate-token.outputs.token }} + result-encoding: string + script: | + const tags = await github.rest.repos.listTags({ + owner: 'DataDog', + repo: 'synthetics-worker' + }) + const regex = /^(?:(?:[0-9]*)[.](?:[0-9]*)[.](?:[0-9]*))$/; + latestTag = tags.data.find(value => regex.test(value)) + console.log(latestTag) + return latestTag \ No newline at end of file