-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (56 loc) · 2.1 KB
/
update.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
name: Update
on:
workflow_dispatch:
schedule:
- cron: "0 7 * * 1"
permissions:
contents: write
pull-requests: write
jobs:
auto:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Render mixins
run: make update
- name: Check for changed mixins
id: status
run: |
if [[ $(git status --short docs | wc -l) -ne 0 ]]; then
version=$(jq -r '.dependencies[] | select(.source.git.remote | contains("kubernetes-mixin")) | .version' jsonnetfile.lock.json)
echo "version=$version" | tee -a "$GITHUB_OUTPUT"
fi
- uses: peter-evans/create-pull-request@v7
if: ${{ steps.status.outputs.version != '' }}
id: cpr
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: Update mixins to ${{ steps.status.outputs.version }}
commit-message: Update mixins to ${{ steps.status.outputs.version }}
sign-commits: true
labels: "auto-update"
branch: mixins-auto-update
body: >
Auto-generated PR from ${{ github.workflow }}
with the mixins update to version ${{ steps.status.outputs.version }}.
- name: Set automerge
if: ${{ steps.cpr.outputs.pull-request-operation == 'created' }}
run: gh pr merge ${{ steps.cpr.outputs.pull-request-number }} --auto --delete-branch --squash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/create-github-app-token@v1
id: app-token
if: ${{ steps.cpr.outputs.pull-request-operation == 'created' }}
with:
app-id: ${{ secrets.app_id }}
private-key: ${{ secrets.app_private_key }}
owner: ${{ github.repository_owner }}
- name: Auto approve
continue-on-error: true
if: ${{ steps.cpr.outputs.pull-request-operation == 'created' }}
run: gh pr review --approve "${{ steps.cpr.outputs.pull-request-number }}"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}