...
1#!/bin/zsh -ex
2
3# Copyright The OpenTelemetry Authors
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17git config user.name opentelemetrybot
18git config user.email 107717825+opentelemetrybot@users.noreply.github.com
19
20BRANCH=dependabot/dependabot-prs/`date +'%Y-%m-%dT%H%M%S'`
21git checkout -b $BRANCH
22
23IFS=$'\n'
24requests=($( gh pr list --search "author:app/dependabot" --json title --jq '.[].title' ))
25message=""
26dirs=(`find . -type f -name "go.mod" -exec dirname {} \; | sort | egrep '^./'`)
27
28declare -A mods
29
30for line in $requests; do
31 echo $line
32 if [[ $line != Bump* ]]; then
33 continue
34 fi
35
36 module=$(echo $line | cut -f 2 -d " ")
37 if [[ $module == go.opentelemetry.io/otel* ]]; then
38 continue
39 fi
40 version=$(echo $line | cut -f 6 -d " ")
41
42 mods[$module]=$version
43 message+=$line
44 message+=$'\n'
45done
46
47for module version in ${(kv)mods}; do
48 topdir=`pwd`
49 for dir in $dirs; do
50 echo "checking $dir"
51 cd $dir && if grep -q "$module " go.mod; then go get "$module"@v"$version"; fi
52 cd $topdir
53 done
54done
55
56make go-mod-tidy
57make build
58
59git add go.sum go.mod
60git add "**/go.sum" "**/go.mod"
61git commit -m "dependabot updates `date`
62$message"
63git push origin $BRANCH
64
65gh pr create --title "[chore] dependabot updates `date`" --body "$message"
View as plain text