-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Enhancement Description
Often an annotation may reference a file that isn't present in the latest file of a commit.
For example:
- User creates a pull request
- An action creates an annotation letting them know their syntax is incorrect
- User can click the link and go directly to the code with the annotation

- User makes an unrelated change to the code and commits it.
- The action runs again and identifies the same syntax error, however the link shown above still only points to the most recent commit and therefore the link is now broken. Example here:
https://github.com/JustinGrote/Super-Duper-Linter/actions/runs/146628514
JustinGrote/Super-Duper-Linter@8925755#annotation_266417563
Recommended Resolution
The annotation engine should first check the commit if the file was edited in the current commit. If not, then it should do the equivalent of git log --follow -n 1 <filepath> to find the most recent commit and generate the annotation and link on that commit.
Alternatively the frontend link engine could be smart enough that, if an annotation is defined on a commit but the file doesn't exist in the commit, then do the equivalent above to find the file in a previous commit that the annotation was referencing and present it. This would probably be a smarter approach to avoid annotations "leaking" into parent branches.
NOTE: if the feature request has been agreed upon then the assignee will create an ADR. See docs/adrs/README.md