File tree 1 file changed +25
-8
lines changed
1 file changed +25
-8
lines changed Original file line number Diff line number Diff line change 25
25
26
26
jobs:
27
27
kustomize-diff:
28
+ permissions:
29
+ pull-requests: write
30
+ contents: write
28
31
runs-on: ubuntu-latest
29
32
steps:
30
- - id: checkout
31
- uses: actions/checkout@v2
33
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
32
34
with:
33
35
fetch-depth: 0
34
36
- id: kustomize-diff
35
- uses: swade1987/github-action-kustomize-diff@master
37
+ uses: swade1987/github-action-kustomize-diff@v0.2.0
36
38
with:
37
- root_dir: "./my-custom-path "
39
+ root_dir: "./kustomize "
38
40
max_depth: "2"
39
41
- id: comment
40
- uses: unsplash/comment-on-pr@master
42
+
41
43
env:
42
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
44
+ OUTPUT : ${{ steps.kustomize-diff.outputs.diff }}
43
45
with:
44
- msg: ${{ steps.kustomize-diff.outputs.diff }}
45
- check_for_duplicate_msg: false
46
+ github-token: ${{ secrets.GITHUB_TOKEN }}
47
+ script: |
48
+ const rawOutput = process.env.OUTPUT;
49
+ const noDiffMessage = "No differences found between";
50
+
51
+ const formattedOutput = rawOutput.includes(noDiffMessage)
52
+ ? `### ${rawOutput}`
53
+ : `### Kustomize Changes\n<details><summary>Show Diff</summary>\n\n\`\`\`diff\n${rawOutput}\n\`\`\`\n</details>`;
54
+
55
+ await github.rest.issues.createComment({
56
+ issue_number: context.issue.number,
57
+ owner: context.repo.owner,
58
+ repo: context.repo.repo,
59
+ body: formattedOutput
60
+ })
46
61
```
47
62
63
+ An example of the commented output can be found [ here] ( https://github.com/swade1987/flux2-kustomize-template/pull/15#issuecomment-2600995488 ) .
64
+
48
65
## Features
49
66
50
67
- Commits must meet [ Conventional Commits] ( https://www.conventionalcommits.org/en/v1.0.0/ )
You can’t perform that action at this time.
0 commit comments