diff --git a/README.md b/README.md
index cf66b473..9236062a 100644
--- a/README.md
+++ b/README.md
@@ -403,6 +403,56 @@ See [inputs](#inputs) for more information.
+
+Get all changed files between the previous tag and the current tag
+
+```yaml
+...
+on:
+ push:
+ tags:
+ - 'v*'
+
+jobs:
+ release:
+ name: Release
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+
+ - name: Get Base SHA
+ id: get-base-sha
+ run: |
+ echo "base_sha=$(git rev-parse "$(git tag --sort=-v:refname | head -n 2 | tail -n 1)")" >> $GITHUB_OUTPUT
+
+ - name: Get changed files
+ id: changed-files
+ uses: tj-actions/changed-files@v35
+ with:
+ base_sha: ${{ steps.get-base-sha.outputs.base_sha }}
+
+ - name: Get changed files in the .github folder
+ id: changed-files-specific
+ uses: tj-actions/changed-files@v35
+ with:
+ base_sha: ${{ steps.get-base-sha.outputs.base_sha }}
+ files: .github/**
+
+ - name: Run step if any file(s) in the .github folder change
+ if: steps.changed-files-specific.outputs.any_changed == 'true'
+ run: |
+ echo "One or more files in the .github folder has changed."
+ echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}"
+...
+```
+
+See [inputs](#inputs) for more information.
+
+
+
Get all changed files for a repository located in a different path
diff --git a/diff-sha.sh b/diff-sha.sh
index 2a915b19..0296c886 100644
--- a/diff-sha.sh
+++ b/diff-sha.sh
@@ -8,6 +8,11 @@ EXTRA_ARGS="--no-tags --prune --no-recurse-submodules"
PREVIOUS_SHA=""
CURRENT_SHA=""
DIFF="..."
+IS_TAG="false"
+
+if [[ "$GITHUB_REF" == "refs/tags/"* ]]; then
+ IS_TAG="true"
+fi
if [[ "$GITHUB_REF" == "refs/tags/"* ]]; then
EXTRA_ARGS="--prune --no-recurse-submodules"
@@ -132,6 +137,10 @@ if [[ -z $GITHUB_EVENT_PULL_REQUEST_BASE_REF ]]; then
fi
else
PREVIOUS_SHA=$INPUT_BASE_SHA
+
+ if [[ "$IS_TAG" == "true" ]]; then
+ TARGET_BRANCH=$(git describe --tags "$PREVIOUS_SHA")
+ fi
fi
echo "::debug::Target branch $TARGET_BRANCH..."