-
Notifications
You must be signed in to change notification settings - Fork 3
90 lines (79 loc) · 2.38 KB
/
helm-releases.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
---
name: Diff Helm Releases
on: # yamllint disable-line rule:truthy
pull_request:
branches:
- main
paths:
- "cluster/**.yaml"
env:
# Currently no way to detect automatically
DEFAULT_BRANCH: main
BOT_USERNAME: wyoa-bot[bot]
jobs:
changes:
name: Get Changes
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: dorny/paths-filter@v2
id: filter
with:
list-files: json
filters: |
yaml:
- added|modified: "**/helm-release.yaml"
outputs:
yamls: ${{ steps.filter.outputs.yaml_files }}
diff:
name: Diff Helm Releases
runs-on: ubuntu-22.04
needs:
- changes
strategy:
matrix:
file: ${{ fromJSON(needs.changes.outputs.yamls) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate Token
uses: tibdex/github-app-token@v2
id: generate-token
with:
app_id: ${{ secrets.BOT_APP_ID }}
private_key: ${{ secrets.BOT_APP_PRIVATE_KEY }}
- name: Checkout default branch
uses: actions/checkout@v4
with:
ref: ${{ env.DEFAULT_BRANCH }}
path: default
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: v3.6.3
- name: Helm Release Differ
id: diff
shell: bash
run: |
diff=$(.github/scripts/helm-release-differ.sh --source-file "default/${{ matrix.file }}" --target-file "${{ matrix.file }}" --remove-common-labels)
echo "${diff}"
diff="${diff//'%'/'%25'}"
diff="${diff//$'\n'/'%0A'}"
diff="${diff//$'\r'/'%0D'}"
echo "diff=$(echo ${diff})" >> $GITHUB_OUTPUT
- name: Find Comment
uses: peter-evans/find-comment@v2
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: ${{ env.BOT_USERNAME }}
body-includes: ${{ matrix.file }}
- name: Create or update comment
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ steps.generate-token.outputs.token }}
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.diff.outputs.diff }}
edit-mode: replace