-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (66 loc) · 1.84 KB
/
Copy pathdiff.yaml
File metadata and controls
71 lines (66 loc) · 1.84 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
name: flux-local diff
permissions:
contents: read
on:
push:
branches-ignore: ["main"]
jobs:
diff:
name: flux diff
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout main
uses: actions/checkout@v6
with:
ref: "${{ github.event.repository.default_branch }}"
path: main
token: ${{ secrets.GIT_TOKEN }}
- name: Checkout PR
uses: actions/checkout@v6
with:
path: pr
token: ${{ secrets.GIT_TOKEN }}
- name: Run flux-local ks diff
uses: docker://ghcr.io/allenporter/flux-local:v8
with:
args: >-
diff ks
--path /github/workspace/pr/k8s/flux
--path-orig /github/workspace/main/k8s/flux
--all-namespaces
--output-file ks.diff
- name: Run flux-local hr diff
uses: docker://ghcr.io/allenporter/flux-local:v8
with:
args: >-
diff hr
--path /github/workspace/pr/k8s/flux
--path-orig /github/workspace/main/k8s/flux
--api-versions monitoring.coreos.com/v1
--all-namespaces
--output-file hr.diff
- name: diff
id: diff
run: |
# merge the 2 diff files
cat hr.diff >> ks.diff
# Message formatting based on diff
{
echo "diff<<EOF"
if [[ -s "ks.diff" ]]; then
echo "Here is the diff to main:"
echo "\`\`\`diff"
cat ks.diff
echo "\`\`\`"
else
echo "No diff to main detected."
fi
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Add Comment
uses: mshick/add-pr-comment@v3
with:
message: |
${{ steps.diff.outputs.diff }}