-
Notifications
You must be signed in to change notification settings - Fork 63
74 lines (73 loc) · 2.09 KB
/
Copy pathflux-diff.yml
File metadata and controls
74 lines (73 loc) · 2.09 KB
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
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: "Flux Diff"
on:
pull_request:
branches: ["main"]
paths: ["kubernetes/**"]
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
jobs:
filter-changes:
name: Filter Changes
runs-on: ubuntu-latest
outputs:
changed-files: ${{ steps.changed-files.outputs.changed_files }}
steps:
- name: Get changed files
id: changed-files
uses: bjw-s-labs/action-changed-files@v0.6.0
with:
patterns: |-
kubernetes/**/*
flate-diff:
name: Flate Diff
runs-on: ubuntu-latest
needs: filter-changes
if: ${{ needs.filter-changes.outputs.changed-files != '[]' }}
env:
FLATE_PATH: ./kubernetes/flux
strategy:
matrix:
cluster_path: ["kubernetes"]
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false
- name: Setup flate
uses: home-operations/flate/action@v0.5.0
with:
cache: true
- name: Test
run: flate test all --allow-missing-secrets --path "${{ matrix.cluster_path }}"
- name: Diff
id: diff
run: |
flate diff all \
--path "${{ matrix.cluster_path }}" \
--base "${{ github.event.pull_request.base.sha }}" \
--allow-missing-secrets \
--no-progress \
-o github > diff.txt
{
echo 'diff<<EOF'
cat diff.txt
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Create PR Comments
if: ${{ steps.diff.outputs.diff != '' }}
uses: mshick/add-pr-comment@v3
continue-on-error: true
with:
message-id: "${{ github.event.pull_request.number }}/${{ matrix.cluster_path }}/flux"
message-failure: Diff was not successful
message: |
```diff
${{ steps.diff.outputs.diff }}
```