github / vscode-github-actions

GitHub Actions extension for VS Code
https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-github-actions
MIT License
499 stars 92 forks source link

Links to specific step logs and duplicate step names #181

Open muzimuzhi opened 1 year ago

muzimuzhi commented 1 year ago

Describe the bug Links to specific step logs implemented in #170 finds step number by step name, but step name may duplicate. Looks like the step number should be retrieved from UI (globe icon of step with which index is clicked?). https://github.com/github/vscode-github-actions/blob/bed6eac0cb7c76c1487f50402111e30d67c1354b/src/commands/openWorkflowStepLogs.ts#L13

To Reproduce Steps to reproduce the behavior:

  1. Clone https://github.com/muzimuzhi/hello-github-actions and open it with vscode
  2. Find the 5th run of workflow "Test GitHub Actions itself"
  3. Expand steps of its only job "Hello GitHub Actions", click the globe icon next to the second step named "Run dummy commands", also the 4th step
  4. https://github.com/muzimuzhi/hello-github-actions/actions/runs/4902036880/jobs/8753647810#step:3:1 opened

image

Expected behavior https://github.com/muzimuzhi/hello-github-actions/actions/runs/4902036880/jobs/8753647810#step:4:1 opened. Note it should be #step:4:1, not #step:3:1.

Screenshots If applicable, add screenshots to help explain your problem.

Extension Version v0.25.7

muzimuzhi commented 1 year ago

Looks like the step number should be retrieved from UI (globe icon of step with which index is clicked?).

Not exactly. Step numbers may jump, for example the job run https://github.com/muzimuzhi/hello-github-actions/actions/runs/4902036880/jobs/8753647810 contains eight steps but numbered

$ gh api \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  /repos/muzimuzhi/hello-github-actions/actions/runs/4902036880/jobs | \
  jq '.jobs[].steps[] | {(.number | tostring): .name}' | jq 'reduce inputs as $in (.; . + $in)'
{
  "1": "Set up job",
  "2": "Run actions/checkout@v3",
  "3": "Run dummy commands",
  "4": "Run dummy commands",
  "5": "Run actions/upload-artifact@v3",
  "6": "Run actions/upload-artifact@v3",
  "12": "Post Run actions/checkout@v3",
  "13": "Complete job"
}

Originally posted by @muzimuzhi in https://github.com/muzimuzhi/hello-github-actions/issues/16#issuecomment-1537163628

so it should be step index from user click -> step -> step.number.

Ppeepost4489 commented 3 days ago

Describe the bug Links to specific step logs implemented in #170 finds step number by step name, but step name may duplicate. Looks like the step number should be retrieved from UI (globe icon of step with which index is clicked?). https://github.com/github/vscode-github-actions/blob/bed6eac0cb7c76c1487f50402111e30d67c1354b/src/commands/openWorkflowStepLogs.ts#L13

To Reproduce Steps to reproduce the behavior:

  1. Clone https://github.com/muzimuzhi/hello-github-actions and open it with vscode
  2. Find the 5th run of workflow "Test GitHub Actions itself"
  3. Expand steps of its only job "Hello GitHub Actions", click the globe icon next to the second step named "Run dummy commands", also the 4th step
  4. https://github.com/muzimuzhi/hello-github-actions/actions/runs/4902036880/jobs/8753647810#step:3:1 opened

image

Expected behavior https://github.com/muzimuzhi/hello-github-actions/actions/runs/4902036880/jobs/8753647810#step:4:1 opened. Note it should be #step:4:1, not #step:3:1.

Screenshots If applicable, add screenshots to help explain your problem.

Extension Version v0.25.7