|
1 |
| -# GitHub Action for kustomize-diff |
| 1 | +# Kustomize Diff GitHub Action |
2 | 2 |
|
3 |
| -This [action](https://help.github.com/en/actions) can be used in any repository that uses [kustomize](https://kustomize.io/). |
| 3 | +This GitHub Action builds and compares Kustomize configurations between the base and head of a Pull Request, posting the differences as a PR comment. This helps reviewers easily identify configuration changes in Kubernetes manifests. |
4 | 4 |
|
5 |
| -# Summary |
| 5 | +## Why Use This Action? |
| 6 | +Managing Kubernetes configurations across multiple environments and PRs can be challenging. This action automatically generates and posts clear diffs of your Kustomize changes directly in your PR comments. This helps: |
6 | 7 |
|
7 |
| -The steps the action takes are as follows: |
| 8 | +🔍 **Catch Configuration Mistakes** - Easily spot unintended changes before they hit production |
| 9 | +⏱️ **Speed Up Reviews** - Reviewers can instantly see what's changing without checking out the code |
| 10 | +🔄 **Validate Changes** - Confirm your Kustomize overlays are working as expected |
| 11 | +📝 **Document Changes** - Automatically track and document configuration changes in PR history |
8 | 12 |
|
9 |
| -- Store the output of `kustomize build` (for each environment) on the current branch in a temporary location. |
10 |
| -- Store the output of `kustomize build` (for each environment) on the master branch in a temporary location. |
11 |
| -- Based on the two outputs above it performs a git diff and stores the output in a variable called `escaped_output`. |
| 13 | +## Features |
| 14 | + |
| 15 | +- Automatically builds Kustomize configurations from both PR branches |
| 16 | +- Generates a diff between base and head configurations |
| 17 | +- Configurable root directory and search depth for Kustomize files |
| 18 | +- Commits must meet [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) |
| 19 | + - Automated with GitHub Actions ([commit-lint](https://github.com/conventional-changelog/commitlint/#what-is-commitlint)) |
| 20 | +- Pull Request titles must meet [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) |
| 21 | + - Automated with GitHub Actions ([pr-lint](https://github.com/amannn/action-semantic-pull-request)) |
| 22 | +- Commits must be signed with [Developer Certificate of Origin (DCO)](https://developercertificate.org/) |
| 23 | + - Automated with GitHub App ([DCO](https://github.com/apps/dco)) |
12 | 24 |
|
13 |
| -This action can be combined with [unsplash/comment-on-pr](https://github.com/unsplash/comment-on-pr) to comment the output to the PR. |
| 25 | +## Inputs |
14 | 26 |
|
15 |
| -# Example configuration |
| 27 | +| Name | Description | Required | Default | |
| 28 | +|------|-------------|----------|---------| |
| 29 | +| `base_ref` | Reference (branch/SHA) for PR base | Yes | `${{ github.base_ref }}` | |
| 30 | +| `head_ref` | Reference (branch/SHA) for PR head | Yes | `${{ github.head_ref }}` | |
| 31 | +| `pr_num` | Pull Request number/ID | Yes | `${{ github.event.number }}` | |
| 32 | +| `token` | GitHub token for authentication | Yes | `${{ github.token }}` | |
| 33 | +| `root_dir` | Root directory containing kustomize files | No | `./kustomize` | |
| 34 | +| `max_depth` | Maximum depth to search for kustomization files | No | `2` | |
| 35 | + |
| 36 | +## Outputs |
| 37 | + |
| 38 | +| Name | Description | |
| 39 | +|------|-------------| |
| 40 | +| `diff` | Generated diff between kustomize built head and base | |
| 41 | + |
| 42 | +## Usage |
16 | 43 |
|
17 | 44 | The below example will run `kustomize-diff` against your branch and commit the changes due to be applied back to your Pull Request.
|
18 | 45 |
|
|
62 | 89 |
|
63 | 90 | An example of the commented output can be found [here](https://github.com/swade1987/flux2-kustomize-template/pull/15#issuecomment-2600995488).
|
64 | 91 |
|
65 |
| -## Features |
66 |
| - |
67 |
| -- Commits must meet [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) |
68 |
| - - Automated with GitHub Actions ([commit-lint](https://github.com/conventional-changelog/commitlint/#what-is-commitlint)) |
69 |
| -- Pull Request titles must meet [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) |
70 |
| - - Automated with GitHub Actions ([pr-lint](https://github.com/amannn/action-semantic-pull-request)) |
71 |
| -- Commits must be signed with [Developer Certificate of Origin (DCO)](https://developercertificate.org/) |
72 |
| - - Automated with GitHub App ([DCO](https://github.com/apps/dco)) |
73 |
| - |
74 |
| -## Getting started |
75 |
| - |
76 |
| -Before working with the repository it is **mandatory** to execute the following command: |
77 |
| - |
78 |
| -``` |
79 |
| -make initialise |
80 |
| -``` |
81 |
| - |
82 |
| -The above command will install the `pre-commit` package and setup pre-commit checks for this repository including [conventional-pre-commit](https://github.com/compilerla/conventional-pre-commit) to make sure your commits match the conventional commit convention. |
83 |
| - |
84 | 92 | ## Contributing to the repository
|
85 | 93 |
|
86 | 94 | To contribute, please read the [contribution guidelines](CONTRIBUTING.md). You may also [report an issue](https://github.com/swade1987/kubernetes-toolkit/issues/new/choose).
|
0 commit comments