11name : Dependency Updates
2-
32on :
43 schedule :
54 - cron : ' 42 5 * * 1' # Mondays at 5:42 AM
65 workflow_dispatch : {} # Manual runs
7-
86permissions : read-all
9-
107jobs :
118 update-go :
129 name : Update Go Dependencies
1613 steps :
1714 - name : Checkout repository
1815 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4
19-
2016 - name : Set up Go
2117 id : setup-go
2218 uses : actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v5
@@ -25,58 +21,51 @@ jobs:
2521 # will bail out if it encounters a "candidate" that requires a newer release.
2622 go-version : stable
2723 cache-dependency-path : ' **/go.mod'
28-
2924 - name : Determine latest github.com/DataDog/dd-trace-go/v2 version
3025 id : dd-trace-go
3126 run : |-
3227 set -euo pipefail
3328 version=$(go list -f '{{range .Versions}}{{.}}{{"\n"}}{{end}}' -m -versions github.com/DataDog/dd-trace-go/v2 | grep -v '-' | tail -n 1)
3429 echo "version=${version}" >> "${GITHUB_OUTPUT}"
35-
3630 # Passing "go@<version>" to "go get -u" ensures no dependencies get upgraded to a release that
3731 # does not support that specific go release. We do `go get -u` everywhere first, and then
3832 # `go mod tidy`, so that the later accounts for the complete updated module graph (otherwise
3933 # we'd need to run these in dependency order to ensure stable output).
4034 - name : Update dependencies
4135 run : |-
42- for gomod in $( find . -iname go.mod -not -path './_docs/themes/**') ; do
36+ find . -iname go.mod -not -path './_docs/themes/**' -print0 | while IFS= read -r -d '' gomod ; do
4337 dir="$(dirname "${gomod}")"
4438 go -C="${dir}" get -t -u "go@$(go -C="${dir}" mod edit -json | jq -r .Go)" "github.com/DataDog/dd-trace-go/v2@${{ steps.dd-trace-go.outputs.version }}" ./...
4539 done
4640 - name : Run go mod tidy
4741 run : |-
48- for gomod in $( find . -iname go.mod -not -path './_docs/themes/**') ; do
42+ find . -iname go.mod -not -path './_docs/themes/**' -print0 | while IFS= read -r -d '' gomod ; do
4943 dir="$(dirname "${gomod}")"
5044 go -C="${dir}" mod tidy -go="$(go -C="${dir}" mod edit -json | jq -r .Go)"
5145 go -C="${dir}" mod edit -toolchain=none
5246 done
53-
5447 - id : is-tree-dirty
5548 name : Check for updates
5649 run : |-
5750 git add .
5851 git diff --staged --patch --exit-code || echo "result=true" >> "${GITHUB_OUTPUT}"
59-
6052 - name : Update LICENSE-3rdparty.csv
6153 if : steps.is-tree-dirty.outputs.result == 'true'
6254 run : ./_tools/make-licenses.sh
6355 env :
6456 TMPDIR : ${{ runner.temp }}
65-
6657 - name : Build diff
6758 if : steps.is-tree-dirty.outputs.result == 'true'
6859 run : |-
6960 git add .
7061 git diff --staged --patch > "${{ runner.temp }}/go.diff.patch"
71-
7262 - name : Upload Artifact
7363 if : steps.is-tree-dirty.outputs.result == 'true'
7464 uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
7565 with :
7666 name : Patches
7767 path : ${{ runner.temp }}/go.diff.patch
7868 if-no-files-found : error
79-
8069 create-pr :
8170 name : Create Pull Request
8271 runs-on : ubuntu-latest
@@ -88,16 +77,13 @@ jobs:
8877 steps :
8978 - name : Checkout repository
9079 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4
91-
9280 - name : Download patches
9381 uses : actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v4
9482 with :
9583 name : Patches
9684 path : ${{ runner.temp }}/patches
97-
9885 - name : Apply patches
9986 run : find "${{ runner.temp }}/patches" -type f -name '*.patch' -exec git apply {} \;
100-
10187 # We use ghcommit to create signed commits directly using the GitHub API
10288 - name : Create branch # The branch needs to exist before we can add commits to it
10389 id : create-branch
@@ -106,14 +92,12 @@ jobs:
10692 git push origin "${{ github.sha }}":"refs/heads/${branch}"
10793 echo "branch=${branch}" >> "${GITHUB_OUTPUT}"
10894 git fetch origin "${branch}"
109-
11095 - name : Generate a GitHub token
11196 id : generate-token
11297 uses : actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
11398 with :
11499 app-id : ${{ vars.DD_K9_LIBRARY_GO_APP_ID }}
115100 private-key : ${{ secrets.DD_K9_LIBRARY_GO_APP_PRIVATE_KEY }}
116-
117101 - name : Create Commit # Adds a commit to the branch we created above
118102 uses : planetscale/ghcommit-action@322be9669498a4be9ce66efc1169f8f43f6bd883 # v0.2.17
119103 with :
@@ -122,7 +106,6 @@ jobs:
122106 branch : ${{ steps.create-branch.outputs.branch }}
123107 env :
124108 GITHUB_TOKEN : ${{ steps.generate-token.outputs.token }}
125-
126109 - name : Create PR
127110 run : |-
128111 git fetch origin "${{ steps.create-branch.outputs.branch }}"
0 commit comments