Skip to content

Commit 7e348ba

Browse files
authored
Chore/version check pipeline (#142)
* chore: add pipeline to check staleness of api versions lock * feat: add badge to readme * fix: update tag * fix: set a periodic schedule for pipeline
1 parent 6c68953 commit 7e348ba

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Check API version lock
2+
3+
on:
4+
# run after PR merge
5+
push:
6+
branches: ["main"]
7+
# run every night at 01:00
8+
schedule:
9+
- cron: "0 1 * * *"
10+
11+
env:
12+
THRESHOLD: "10 days ago"
13+
14+
jobs:
15+
main-go:
16+
name: "[Go] Update SDK Repo"
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
- name: Check commit date
22+
run: |
23+
set -eo pipefail
24+
25+
THRESHOLD="10 minutes ago"
26+
27+
if jq -e 'map_values(select(. != "main")) != {}' api-versions-lock.json; then
28+
thresholdDate=$(date -Iminutes -d "${THRESHOLD}")
29+
commitDate=$(git -P log -n 1 --format="%aI" api-versions-lock.json)
30+
if [[ "$commitDate" < "$thresholdDate" ]]; then
31+
echo "latest commit of api-versions-lock.json is older than ${THRESHOLD}"
32+
exit 1
33+
fi
34+
echo "api-versions-lock.json contains locked versions but is recent enough"
35+
else
36+
echo "no locked versions in api-versions-lock.json"
37+
fi

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[![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)
2+
13
# Overview
24

35
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).

0 commit comments

Comments
 (0)