Skip to content

Commit 568793e

Browse files
authored
Merge pull request #8 from swade1987/update-readme-example
docs: update readme example
2 parents 0e7ef48 + b580b98 commit 568793e

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

README.md

+25-8
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,43 @@ on:
2525
2626
jobs:
2727
kustomize-diff:
28+
permissions:
29+
pull-requests: write
30+
contents: write
2831
runs-on: ubuntu-latest
2932
steps:
30-
- id: checkout
31-
uses: actions/checkout@v2
33+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
3234
with:
3335
fetch-depth: 0
3436
- id: kustomize-diff
35-
uses: swade1987/github-action-kustomize-diff@master
37+
uses: swade1987/github-action-kustomize-diff@v0.2.0
3638
with:
37-
root_dir: "./my-custom-path"
39+
root_dir: "./kustomize"
3840
max_depth: "2"
3941
- id: comment
40-
uses: unsplash/comment-on-pr@master
42+
uses: actions/[email protected]
4143
env:
42-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
OUTPUT: ${{ steps.kustomize-diff.outputs.diff }}
4345
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+
})
4661
```
4762

63+
An example of the commented output can be found [here](https://github.com/swade1987/flux2-kustomize-template/pull/15#issuecomment-2600995488).
64+
4865
## Features
4966

5067
- Commits must meet [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)

0 commit comments

Comments
 (0)