generated from onedr0p/cluster-template
-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (45 loc) · 1.42 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:
contents: read
pull-requests: write
strategy:
matrix:
path: ["kubernetes"]
resource: ["helmrelease", "kustomization"]
steps:
- name: Setup Flux CLI
uses: fluxcd/flux2/action@main
with:
# Flux CLI version e.g. 2.0.0.
# Defaults to latest stable release.
version: 'latest'
# Alternative download location for the Flux CLI binary.
# Defaults to path relative to $RUNNER_TOOL_CACHE.
bindir: ''
- name: Diff Resources
uses: allenporter/flux-local/action/diff@bfff4ac1f313c2ef82aed95a8dd5241c0ee0def6 # 6.0.2
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@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2.8.2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
message-id: "${{ github.event.pull_request.number }}/${{ matrix.path }}/${{ matrix.resource }}"
message-failure: Diff was not successful
message: |
```diff
${{ steps.diff.outputs.diff }}
```