Skip to content

Annotation links from composite actions have incorrect step numbers in links #1901

@konradpabjan

Description

@konradpabjan

Describe the bug

On a similar pattern as #1742 Annotations from composite actions are a bit broken compared to their normal counter parts. Recently support was added for annotations to link out directly to the log position they were created from so it's easier to see where they came from. For this linking the step number and line number information need to be saved and provided by the runner. For composite actions the step number that is provided does not match and links are incorrect.

To Reproduce

Steps to reproduce the behavior:

  1. Create a simple composite actions that generates annotations
name: 'Annotation example'
description: Test annotations
runs:
  using: "composite"
  steps:
    - run: echo Hello there once!
      shell: bash
    - name: Testing the Error Workflow Command
      run: echo "::error::Testing error"
      shell: bash
    - run: echo Hello there
      shell: bash
    - name: Testing the Error Workflow Command
      run: echo "::error::Testing error"
      shell: bash
    - name: Testing the Error Workflow Command
      run: echo "::warning::Testing warning"
      shell: bash
    - name: Testing the Error Workflow Command
      run: echo "::notice::Testing notice"
      shell: bash
  1. Run the workflow from another repository (or locally)

  2. Inspect or click the the annotation from the run summary page

image

Expected behavior
Clicking the annotation should directly link out to the log line, expand the correct step and scroll to the exact position the annotation originates from.

Runner Version and Platform

Version of your runner? 2.291.1

Linux, but this is most likely on all types of runners

What's not working?

From the screenshot above, the annotation link should work but it fails because the step number is wrong: The line number the annotation originates from is correct (35), however the step number (16), is way off compared to what it should be (something like 2,3 or 4).

Specifically the step number that gets used in the URL gets set here:

// Tracking the line number (logFileLineNumber) and step number (stepNumber) for each issue that gets created
// Actions UI from the run summary page use both values to easily link to an exact locations in logs where annotations originate from
if (_record.Order != null)
{
issue.Data["stepNumber"] = _record.Order.ToString();
}

For composite actions issue.Data["stepNumber"] needs to be set to something else like the parent of the composite action that houses the entire step. Not sure how easy that will be to do 🤷

The original work to save this information for other annotations was done as part of this PR: #1744

Job Log Output

Not applicable

Runner and Worker's Diagnostic Logs

Not applicable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Runner BugBug fix scope to the runnerStalebugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions