From ea9897b102976d9b40d94b92efe0e62af4b19d9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Schmitz?= <152157960+bahkauv70@users.noreply.github.com> Date: Fri, 14 Mar 2025 17:17:37 +0100 Subject: [PATCH 1/4] chore: add pipeline to check staleness of api versions lock --- .github/workflows/check-api-versions.yaml | 31 +++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/check-api-versions.yaml diff --git a/.github/workflows/check-api-versions.yaml b/.github/workflows/check-api-versions.yaml new file mode 100644 index 0000000..c5947e6 --- /dev/null +++ b/.github/workflows/check-api-versions.yaml @@ -0,0 +1,31 @@ +name: Check API version lock + +on: [pull_request, workflow_dispatch] + +env: + THRESHOLD: "10 days ago" + +jobs: + main-go: + name: "[Go] Update SDK Repo" + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Check commit date + run: | + set -eo pipefail + + THRESHOLD="10 days ago" + + if jq -e 'map_values(select(. != "main")) != {}' api-versions-lock.json; then + thresholdDate=$(date -Iminutes -d "${THRESHOLD}") + commitDate=$(git -P log -n 1 --format="%aI" api-versions-lock.json) + if [[ "$commitDate" < "$thresholdDate" ]]; then + echo "latest commit of api-versions-lock.json is older than ${THRESHOLD}" + exit 1 + fi + echo "api-versions-lock.json contains locked versions but is recent is enough" + else + echo "no locked versions in api-versions-lock.json" + fi From 669fe7b590b383911e3af4cc9fefdb67da64f141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Schmitz?= <152157960+bahkauv70@users.noreply.github.com> Date: Fri, 14 Mar 2025 17:35:38 +0100 Subject: [PATCH 2/4] feat: add badge to readme --- .github/workflows/check-api-versions.yaml | 6 +++--- README.md | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-api-versions.yaml b/.github/workflows/check-api-versions.yaml index c5947e6..d038c4a 100644 --- a/.github/workflows/check-api-versions.yaml +++ b/.github/workflows/check-api-versions.yaml @@ -15,8 +15,8 @@ jobs: - name: Check commit date run: | set -eo pipefail - - THRESHOLD="10 days ago" + + THRESHOLD="10 minutes ago" if jq -e 'map_values(select(. != "main")) != {}' api-versions-lock.json; then thresholdDate=$(date -Iminutes -d "${THRESHOLD}") @@ -25,7 +25,7 @@ jobs: echo "latest commit of api-versions-lock.json is older than ${THRESHOLD}" exit 1 fi - echo "api-versions-lock.json contains locked versions but is recent is enough" + echo "api-versions-lock.json contains locked versions but is recent enough" else echo "no locked versions in api-versions-lock.json" fi diff --git a/README.md b/README.md index 6be8002..bf8c98f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +![locked versions uptodate](https://github.com/stackitcloud/stackit-sdk-generator/actions/workflows/check-api-versions.yaml/badge.svg) + # Overview This repository implements the automatic generation of client libraries to access STACKIT APIs. It is based on the [OpenAPI Generator](https://openapi-generator.tech/). The process' input are the REST API specs in the [OpenAPI Specification](https://github.com/OAI/OpenAPI-Specification) format (OAS), which are stored in [STACKIT API specifications](https://github.com/stackitcloud/stackit-api-specifications). From a1197ca17a07c540b1dc07b2678c05b5a87c1fbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Schmitz?= <152157960+bahkauv70@users.noreply.github.com> Date: Mon, 17 Mar 2025 08:34:52 +0100 Subject: [PATCH 3/4] fix: update tag --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bf8c98f..72666fd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![locked versions uptodate](https://github.com/stackitcloud/stackit-sdk-generator/actions/workflows/check-api-versions.yaml/badge.svg) +[![Check API version lock](https://github.com/stackitcloud/stackit-sdk-generator/actions/workflows/check-api-versions.yaml/badge.svg)](https://github.com/stackitcloud/stackit-sdk-generator/actions/workflows/check-api-versions.yaml) # Overview From bec6b1c79f8b896366325ee6f4e6ffd1f84667aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Schmitz?= <152157960+bahkauv70@users.noreply.github.com> Date: Mon, 17 Mar 2025 12:46:38 +0100 Subject: [PATCH 4/4] fix: set a periodic schedule for pipeline --- .github/workflows/check-api-versions.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-api-versions.yaml b/.github/workflows/check-api-versions.yaml index d038c4a..485d8a7 100644 --- a/.github/workflows/check-api-versions.yaml +++ b/.github/workflows/check-api-versions.yaml @@ -1,6 +1,12 @@ name: Check API version lock -on: [pull_request, workflow_dispatch] +on: + # run after PR merge + push: + branches: ["main"] + # run every night at 01:00 + schedule: + - cron: "0 1 * * *" env: THRESHOLD: "10 days ago"