-
Notifications
You must be signed in to change notification settings - Fork 1.5k
142 lines (137 loc) · 5.99 KB
/
Copy pathdeps-tidy.yml
File metadata and controls
142 lines (137 loc) · 5.99 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
---
name: "Tidy Dependencies"
on:
pull_request:
types:
- opened
- synchronize
permissions: {}
jobs:
go_mod_tidy:
if: ${{ github.repository == 'DataDog/datadog-agent' && github.event.pull_request.user.login == 'renovate[bot]' && contains(github.event.pull_request.labels.*.name, 'dependencies-go') }}
concurrency:
group: deps-tidy-go-${{ github.event.pull_request.number }}
cancel-in-progress: true
permissions:
id-token: write # Required for dd-octo-sts OIDC token
pull-requests: write # Required to auto-close PRs that bump the root go directive
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- uses: ./.github/actions/deps-tidy-setup
id: setup
- name: Install go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version-file: ".go-version"
- name: Install dda
uses: ./.github/actions/install-dda
with:
features: legacy-tasks
- name: Go mod tidy
run: dda inv -- -e tidy
- name: Close PR if root go directive was bumped
env:
BASE_REF: ${{ github.event.pull_request.base.ref }}
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
base_directive="$(git show "origin/$BASE_REF:go.mod" | grep -E '^go [0-9]' | head -1)"
current_directive="$(grep -E '^go [0-9]' go.mod | head -1)"
if [ "$base_directive" != "$current_directive" ]; then
echo "::warning::Root go.mod 'go' directive changed from '$base_directive' to '$current_directive'. Auto-closing this PR — a dependency requires a newer Go version than the repo."
gh pr comment "$PR_NUMBER" --body "Auto-closing: this update bumps the root \`go.mod\` \`go\` directive from \`$base_directive\` to \`$current_directive\`. Hold this dependency update until we bump the repository's Go version."
gh pr close "$PR_NUMBER"
exit 1
fi
- name: Update LICENSE-3rdparty.csv
if: ${{ !contains(github.event.pull_request.labels.*.name, 'dependencies-go-tools') }}
run: |
dda inv -- -e install-tools
dda inv -- -e generate-licenses
- name: Update mocks
if: ${{ !contains(github.event.pull_request.labels.*.name, 'dependencies-go-tools') }}
run: dda inv -- -e security-agent.gen-mocks
- uses: ./.github/actions/deps-tidy-push
with:
token: ${{ steps.setup.outputs.token }}
commit-message: "[renovate skip] Auto-generate go.sum and LICENSE-3rdparty.csv changes"
cargo_tidy:
if: ${{ github.repository == 'DataDog/datadog-agent' && github.event.pull_request.user.login == 'renovate[bot]' && contains(github.event.pull_request.labels.*.name, 'dependencies-cargo') }}
concurrency:
group: deps-tidy-cargo-${{ github.event.pull_request.number }}
cancel-in-progress: true
permissions:
id-token: write # Required for dd-octo-sts OIDC token
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: ${{ github.head_ref }}
- uses: ./.github/actions/deps-tidy-setup
id: setup
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
with:
toolchain: stable
- name: Repin Bazel Rust lockfile
run: |
bazel mod tidy
bazel mod deps
- name: Generate Rust licenses
run: |
cargo install dd-rust-license-tool@1.0.6 --locked
cd rust && dd-rust-license-tool --manifest-path ../Cargo.toml write
- uses: ./.github/actions/deps-tidy-push
with:
token: ${{ steps.setup.outputs.token }}
commit-message: "[renovate skip] Auto-repin Bazel Rust lockfile and regenerate Rust licenses"
bazel_native_tidy:
if: ${{ github.repository == 'DataDog/datadog-agent' && github.event.pull_request.user.login == 'renovate[bot]' && contains(github.event.pull_request.labels.*.name, 'dependencies-bazel-native') }}
permissions:
id-token: write # Required for dd-octo-sts OIDC token
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- uses: ./.github/actions/deps-tidy-setup
id: setup
- name: Install dda
uses: ./.github/actions/install-dda
with:
features: legacy-tasks
- name: Refresh http_archive sha256 for changed deps
env:
BRANCH: ${{ github.event.pull_request.base.ref }}
run: dda inv -- renovate.refresh-archive-hashes --base-ref=origin/${BRANCH}
- uses: ./.github/actions/deps-tidy-push
with:
token: ${{ steps.setup.outputs.token }}
commit-message: "[renovate skip] Auto-refresh http_archive sha256"
bazel_tidy:
if: ${{ github.repository == 'DataDog/datadog-agent' && github.event.pull_request.user.login == 'renovate[bot]' && contains(github.event.pull_request.labels.*.name, 'dependencies-bazel') }}
concurrency:
group: deps-tidy-bazel-${{ github.event.pull_request.number }}
cancel-in-progress: true
permissions:
id-token: write # Required for dd-octo-sts OIDC token
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: ${{ github.head_ref }}
- uses: ./.github/actions/deps-tidy-setup
id: setup
- name: Repin Bazel module lockfile
run: |
bazel mod tidy
bazel mod deps
- uses: ./.github/actions/deps-tidy-push
with:
token: ${{ steps.setup.outputs.token }}
commit-message: "[renovate skip] Auto-repin Bazel module lockfile"