-
Notifications
You must be signed in to change notification settings - Fork 50
154 lines (129 loc) · 4.92 KB
/
auto-update-deps.yaml
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
143
144
145
146
147
148
149
150
151
152
153
154
# Copyright 2021 The Knative Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##
## This file is auto-generated from actions/update-deps/auto-apply.yaml
## by ./cmd/gen-actions
##
name: Update Deps and Codegen
on:
schedule:
- cron: '0 1,13 * * 1-5' # 6am/pm Pacific on weekdays
workflow_dispatch:
inputs:
only-repo:
description: "Only autogenerate a single repo (exact match)?"
reason:
description: "Justification?"
required: true
release:
description: "Release version? (vX.Y) defaults to current release"
pr-empty-deps:
description: "If true, send update PRs even for deps changes that don't change vendor. Use this only for releases."
default: "false"
branch:
description: "Branch Name? (empty for default branch of the respective repository)"
jobs:
meta:
runs-on: ubuntu-latest
outputs:
includes: ${{ steps.load-matrix.outputs.includes }}
names: ${{ steps.load-matrix.outputs.names }}
steps:
- name: Check out knobots configuration
uses: actions/checkout@v4
- name: Calculate affected repos
id: load-matrix
uses: "./actions/calculate-matrix"
with:
action-name: deps
only-repo: ${{ github.event.inputs.only-repo }}
apply-change:
name: "Apply Change" # TODO: from metadata?
needs: meta
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 5
matrix:
name: ${{ fromJson(needs.meta.outputs.names) }}
include: ${{ fromJson(needs.meta.outputs.includes) }}
steps:
- name: Checkout config code
uses: actions/checkout@v4
with:
path: config
- name: Checkout ${{ matrix.name }} code
uses: actions/checkout@v4
with:
path: main
repository: ${{ matrix.name }}
ref: ${{ github.event.inputs.branch }}
# This is required because the branch setting might be empty (to infer a default), so
# after checkout we fetch what the checkout action decided to check out.
- name: Infer branch from checkout
id: inferbranch
run: |
cd main
echo "branch=$(git branch --show-current)" >> $GITHUB_OUTPUT
- name: Apply work
id: work
uses: "./config/actions/update-deps"
with:
repo: ${{ matrix.name }}
organization: ${{ matrix.meta-organization }}
include: ${{ matrix.include }}
release: "${{ github.event.inputs.release }}"
pr-empty-deps: "${{ github.event.inputs.pr-empty-deps }}"
branch: "${{ github.event.inputs.branch }}"
- name: Create Pull Request
id: cpr
if: ${{ env.create_pr == 'true' }}
uses: peter-evans/create-pull-request@v7
with:
# Who to look like
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
committer: "Knative Automation <[email protected]>"
author: "Knative Automation <[email protected]>"
# Where to stage the change
push-to-fork: ${{ matrix.fork }}
branch: auto-updates/update-deps-${{ steps.inferbranch.outputs.branch }}
signoff: true
delete-branch: true
# What labels to add
labels: ${{ env.pr_labels }}
# Note this is hard-coded based on the added repos in main.go
path: main
commit-message: |
upgrade to latest dependencies
${{ steps.work.outputs.log }}
title: "[${{ steps.inferbranch.outputs.branch }}] Upgrade to latest dependencies"
body: |
${{ github.event.inputs.reason || 'Cron' }} -${{ github.actor }}
/cc ${{ matrix.assignees }}
/assign ${{ matrix.assignees }}
Produced by: ${{ github.repository }}/actions/update-deps
- name: Report error
uses: rtCamp/action-slack-notify@v2
if: ${{ failure() }}
env:
SLACK_ICON: http://github.com/knative-automation.png?size=48
SLACK_USERNAME: knative-automation
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: ${{ matrix.channel }}
SLACK_COLOR: '#8E1600'
MSG_MINIMAL: 'true'
SLACK_TITLE: "[${{ steps.inferbranch.outputs.branch }}] Upgrade to latest dependencies for ${{ matrix.name }} failed."
SLACK_MESSAGE: |
For detailed logs: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
${{ github.event.inputs.reason || 'Cron' }} -${{ github.actor }}