Skip to content

Commit ea9897b

Browse files
committed
chore: add pipeline to check staleness of api versions lock
1 parent e701cb9 commit ea9897b

File tree

1 file changed

+31
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)