File tree 3 files changed +57
-2
lines changed 3 files changed +57
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ name : Generate Metric files for new Go version
3
+
4
+ on :
5
+ workflow_dispatch :
6
+ schedule :
7
+ - cron : ' 0 0 1 * *'
8
+
9
+ jobs :
10
+ update-go-versions :
11
+ name : Update Go Versions and Generate Tests
12
+ runs-on : ubuntu-latest
13
+
14
+ steps :
15
+ - name : Checkout repository
16
+ uses : actions/checkout@v4
17
+
18
+ - name : Execute bash script
19
+ run : bash update-go-version.bash
20
+
21
+ # If there are no changes (i.e. no diff exists with the checked-out base branch),
22
+ # no pull request will be created and the action exits silently.
23
+ - name : Create a Pull Request
24
+ if : github.event_name != 'pull_request'
25
+ uses : peter-evans/create-pull-request@v6
26
+ with :
27
+ token : ${{ secrets.GITHUB_TOKEN }}
28
+ commit-message : " Update Go Collector metrics for new Go version"
29
+ title : " chore: Update metrics for new Go version"
30
+ branch : update-metrics-for-new-go-version
31
+ base : main
32
+ draft : false
33
+ delete-branch : true
Original file line number Diff line number Diff line change @@ -22,8 +22,7 @@ test-short: deps common-test-short
22
22
23
23
.PHONY : generate-go-collector-test-files
24
24
file := supported_go_versions.txt
25
- # take top 3 versions
26
- VERSIONS := $(shell cat ${file} | head -n 3)
25
+ VERSIONS := $(shell cat ${file})
27
26
generate-go-collector-test-files :
28
27
for GO_VERSION in $( VERSIONS) ; do \
29
28
docker run \
Original file line number Diff line number Diff line change
1
+ #! /bin/env bash
2
+
3
+ set -e
4
+
5
+ get_latest_versions () {
6
+ curl -s https://go.dev/VERSION? m=text | sed -E -n ' s/go([0-9]+\.[0-9]+|\.[0-9]+).*/\1/p'
7
+ }
8
+
9
+ current_version=$( cat supported_go_versions.txt | head -n 1)
10
+ latest_version=$( get_latest_versions)
11
+
12
+ # Check for new version of Go, and generate go collector test files
13
+ # Add new Go version to supported_go_versions.txt, and remove the oldest version
14
+ if [[ ! $current_version =~ $latest_version ]]; then
15
+ echo " New Go version available: $latest_version "
16
+ echo " Updating supported_go_versions.txt and generating Go Collector test files"
17
+ sed -i " 1i $latest_version " supported_go_versions.txt
18
+ sed -i ' $d' supported_go_versions.txt
19
+ make generate-go-collector-test-files
20
+ else
21
+ echo " No new Go version detected. Current Go version is: $current_version "
22
+ fi
23
+
You can’t perform that action at this time.
0 commit comments