Skip to content

Action to compute diff and post it to comment

License

Notifications You must be signed in to change notification settings

FATMAP/diff-action

 
 

Repository files navigation

diff-action ts

This is an action to compute a diff between head and base, and post it to a comment.

Getting Started

To compute the diff between old-directory and new-directory:

      - uses: int128/diff-action@v1
        with:
          base: old-directory
          head: new-directory

Show diff of generated manifests

If you use kustomize build in your CI/CD pipeline, it would be useful if you can see the diff on a pull request.

To build manifests with int128/kustomize-action and show diff of it:

jobs:
  diff:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/checkout@v2
        with:
          ref: main
          path: main
      - uses: int128/kustomize-action@v1
        id: kustomize-head
        with:
          kustomization: config/default/kustomization.yaml
          write-individual-files: true
      - uses: int128/kustomize-action@v1
        id: kustomize-base
        with:
          base-directory: main
          kustomization: config/default/kustomization.yaml
          write-individual-files: true
      - uses: int128/diff-action@v1
        with:
          base: ${{ steps.kustomize-base.outputs.directory }}
          head: ${{ steps.kustomize-head.outputs.directory }}

Here is an example.

image

Label to indicate the change

To add label(s) if there is difference or remove it if not:

      - uses: int128/diff-action@v1
        with:
          base: ${{ steps.kustomize-base.outputs.directory }}
          head: ${{ steps.kustomize-head.outputs.directory }}
          label: manifest-changed

Specification

This action posts a comment on pull request event only.

Inputs

Name Required Description
base (required) base path (multiline)
head (required) head path (multiline)
label - label(s) to add/remove to indicate diff (multiline)
comment-header - header of a comment to post
comment-footer - footer of a comment to post
token github.token GitHub token to post a comment

Outputs

Name Description
different true if there is any difference, or false

About

Action to compute diff and post it to comment

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 93.5%
  • JavaScript 6.5%