-
Notifications
You must be signed in to change notification settings - Fork 3
49 lines (44 loc) · 1.51 KB
/
flux-diff.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
---
name: "Flux Diff"
on:
pull_request:
branches: ["main"]
paths: ["kubernetes/**.yaml"]
jobs:
flux-diff:
name: Flux Diff
runs-on: ubuntu-latest
permissions:
pull-requests: write
strategy:
matrix:
path: ["kubernetes/main"]
resource: ["helmrelease", "kustomization"]
steps:
- name: Generate Token
uses: actions/create-github-app-token@2986852ad836768dfea7781f31828eb3e17990fa # v1.6.2
id: app-token
with:
app-id: "${{ secrets.BOT_APP_ID }}"
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"
- name: Setup Flux
uses: fluxcd/flux2/action@53ad742e2d0f6f0df19ec11a25a0e3adce80c475 # v2.2.0
- name: Diff Resources
# uses: allenporter/flux-local/action/diff@19bfc6920e8964a479363bc230e6c329120ead02 # 3.2.0
uses: allenporter/flux-local/action/diff@flux-build
id: diff
with:
sources: home-kubernetes
path: "${{ matrix.path }}"
resource: "${{ matrix.resource }}"
- if: ${{ steps.diff.outputs.diff != '' }}
name: Add comment
uses: mshick/add-pr-comment@7c0890544fb33b0bdd2e59467fbacb62e028a096 # v2.8.1
with:
repo-token: "${{ steps.app-token.outputs.token }}"
message-id: "${{ github.event.pull_request.number }}/${{ matrix.path }}/${{ matrix.resource }}"
message-failure: Diff was not successful
message: |
```diff
${{ steps.diff.outputs.diff }}
```