-
Notifications
You must be signed in to change notification settings - Fork 3
59 lines (53 loc) · 1.83 KB
/
update-gomod-for-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Update go.mod for testing
on:
schedule:
- cron: "0 4 * * *" # time is in UTC
jobs:
updateAndCreatePR:
env:
GOFLAGS: "-mod=mod"
GOWORK: "off"
defaults:
run:
working-directory: .
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: Update SDK version in go.mod
id: updatesdk
working-directory: .
run: |
make dep-version sdk=main
set +e # Grep succeeds with nonzero exit codes to show results.
git status | grep modified
if [ $? -eq 0 ]
then
echo -e "Committing dependency changes"
git config --global user.email [email protected]
git config --global user.name builder-lphxmjtnt11
git commit --allow-empty -m "Updating SDK in go.mod"
echo "gomodChanged=y" >> $GITHUB_OUTPUT
else
echo -e "No dependency changes since last run"
echo "gomodChanged=n" >> $GITHUB_OUTPUT
fi
set -e
- name: Create Pull Request
if: ${{ steps.updatesdk.outputs.gomodChanged == 'y' }}
id: cpr
uses: peter-evans/create-pull-request@v6
with:
branch: APIGOV-UpdateSDKForTesting
commit-message: 'Update to SDK for testing'
title: 'APIGOV-UpdateSDKForTesting - Update SDK for testing'
delete-branch: true
reviewers: dfeldick
- name: Enable Pull Request Automerge
if: ${{ steps.updatesdk.outputs.gomodChanged == 'y' }}
run: gh pr merge APIGOV-UpdateSDKForTesting --admin --merge --subject "Merge branch APIGOV-UpdateSDKForTesting"
env:
GH_TOKEN: ${{ secrets.ACTION_ACCESS_TOKEN }}