Skip to content

[Annotations] Should link to most recent version of file #566

@JustinGrote

Description

@JustinGrote

Enhancement Description

Often an annotation may reference a file that isn't present in the latest file of a commit.

For example:

  1. User creates a pull request
  2. An action creates an annotation letting them know their syntax is incorrect
  3. User can click the link and go directly to the code with the annotation
    image
  4. User makes an unrelated change to the code and commits it.
  5. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions