[BUG] No changes detected for new tag
Is there an existing issue for this?
- [x] I have searched the existing issues
Does this issue exist in the latest version?
- [x] I'm using the latest release
Describe the bug?
When trying to build a new release tag (v*), the action does not select any previous commit and fails to report any changes.
To Reproduce
- create workflow triggered on tag push:
on:
push:
tags:
- v*
- add and commit some dummy files, over a few commits
- tag the latest commit as
v1.0.0and push the tag
What OS are you seeing the problem on?
ubuntu-latest or ubuntu-22.04
Expected behavior?
Changes detected correctly.
Relevant log output
changed-files
Using local .git directory
Running on a push event...
Warning: No previous tag found
Error: Unable to locate the commit sha:
Error: Please verify that the commit sha is correct, and increase the 'fetch_depth' input if needed
Retrieving changes between () → e6eb9203c6c2c87b4dad7177f06eddb6ad80e024 (v1.0.0)
All Done!
Has all relevant logs been included?
- [x] I've included all relevant logs
Anything else?
I've enabled fetch-depth: 0 for my checkout step, so it's not like the history is missing.
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Thanks for reporting this issue, don't forget to star this project if you haven't already to help us reach a wider audience.
Hi @mpern, can provided the full workflow code including the checkout and changed-files configuration note the fetch-depth needs to be set to 0 for the checkout action.
Example
on:
push:
tags:
- 'v*'
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@823fcebdb31bb35fdf2229d9f769b400309430d0 # v46
- name: List changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
echo "List all the files that have changed: $ALL_CHANGED_FILES"
- name: Get changed files in the .github folder
id: changed-files-specific
uses: tj-actions/changed-files@823fcebdb31bb35fdf2229d9f769b400309430d0 # v46
with:
files: .github/**
- name: Run step if any file(s) in the .github folder change
if: steps.changed-files-specific.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-files-specific.outputs.all_changed_files }}
run: |
echo "One or more files in the .github folder has changed."
echo "List all the files that have changed: $ALL_CHANGED_FILES"
...
Closing since this hasn't had any response