This github action will look at th differences from the current branch towards the branch determined by $GITHUB_REF and highlight based on the configuration if significant changes have taken place.
It will analyze all the file changes and do the following:
- Compare the added & removed lines for each change that occurred in each file and determine the Levenshtein distance between the two versions
- Validate the extension of the file:
- files that are part of the
allowed-file-typeswill be checked for theld-thresholdand haveimpact-level:considerableif above the threshold - other files will automatically count as
impact-level:considerable
- files that are part of the
- When there is no file with
impact-level:considerable, it is deemedlow
The impact level is returned as output, so it can be used in your workflow, e.g. to determine if a PR can automatically be approved.
Optional The maximum Levenshtein distance allowed for the changes to be considered as low impact. Default 10.
Optional The types of files that are analyzed. Default md.
Optional The git base ref to compare against. Default is $GITHUB_BASE_REF, but this is only filled for pull requests. For use in other scenarios, define the base yourself.
The level of impact on the commit, this can be:
- low : this means all analyzed files are below the set threshold
- considerable : this means either files were changed that do not match
allowed-file-types, or the changes in at least one of the analyzed files is above the threshold.
jobs:
test_job:
runs-on: ubuntu-latest
name: Test the action
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Diff Analyzer
uses: raimondb/git-diff-analyzer@v0.9
id: diff-analyze
with:
ld-threshold: 8
allowed-file-types: 'md'
# Use the output from the previous step
- name: Show the output
run: echo "The change was impact-level ${{ steps.diff-analyze.outputs.impact-level }}"