Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: poc octo run list #638

Merged
merged 67 commits into from
Feb 23, 2025
Merged

Conversation

GustavEikaas
Copy link
Contributor

@GustavEikaas GustavEikaas commented Oct 15, 2024

Important

This is a draft PR
Im making this draft PR so I can get reviews/suggestions during development
I will fill out the PR template when the PR is ready for review

Resolves: #149

Describe what this PR does / why we need it

First PR in a series of PRs to add support for github actions

Does this pull request fix one issue?

Describe how you did it

Describe how to verify it

Special notes for reviews

Checklist

  • Passing tests and linting standards
  • Documentation updates in README.md and doc/octo.txt

Feature checklist

  • Buffer
    • Expand/collapse node
    • Highlights
    • Keybindings
      • Refresh
  • Workflows
    • Support multiple jobs
  • Workflow job steps
    • Logs
    • Status
    • ##[group]
    • [command]

Remaining

  • Customizable keymappings
  • Customizable icons
  • Update readme
  • Cleanup code
  • Customizable refresh interval
  • Look into using graphql in favor of gh cli commands (not sure if strictly necessary but conforms to the repo standard)
  • Use telescope pickers from the repo
  • Understand the writers.lua file and extend it
  • Use existing octo window creator

@wd60622
Copy link
Collaborator

wd60622 commented Oct 17, 2024

Using graphql is not a big deal. Just use whatever endpoint that works. Think there are a few non graphql commands used.

@GustavEikaas
Copy link
Contributor Author

Ah okay, functionality wise, do you have any feedback?

@wd60622
Copy link
Collaborator

wd60622 commented Oct 17, 2024

Ah okay, functionality wise, do you have any feedback?

I will give it a try when I can!

@wd60622 wd60622 added the enhancement New feature or request label Oct 17, 2024
@wd60622
Copy link
Collaborator

wd60622 commented Oct 18, 2024

Think it looks good. Would you want to make use of the pickers instead of the new, custom buffer? I have been using telescope recently. What do you use?

Some items:

  • What do you expect the callback to be upon selection an item? We can work something in like Abitrary callbacks for pickers #642 in order to support more in the future.
  • Would there be a preview or buffer to show each item? What would be populated there? Maybe a buffer doesn't make sense here. What are your thoughts?

@GustavEikaas
Copy link
Contributor Author

image
@wd60622 Is this what you meant, kinda like the PR and issue flow?

@GustavEikaas
Copy link
Contributor Author

You still want there to be a buffer when you press <CR> on one of the items in the picker. AKA same flow as pull request?

@pwntester
Copy link
Owner

Thanks for the PR @GustavEikaas!

I like the idea of showing the status of the run in the preview buffer and perhaps show the logs of the run upon opening the item with <CR>. The problem I see is that a run may contain multiple jobs and each job will have its own log. Should we present them sequentially? thoughts?

@GustavEikaas
Copy link
Contributor Author

IIRC the sequential jobs is already supported but yes I was thinking the same.
For the logs of every step we should probably lazy load and use fold or something similiar. Some steps have very long log outputs

@GustavEikaas
Copy link
Contributor Author

@pwntester
Here is an image of what it looks like with multiple jobs
image

@GustavEikaas
Copy link
Contributor Author

Doesnt seem like there is a good structured output for workflow logs. Will probably be tricky to have the same UI as github web.
Only way I see right now is query the workflow logs and using regex to match the lines to the corresponding steps

@pwntester
Copy link
Owner

Nice, perhaps we can do a nested telescope selection where the use first chooses the run and then the job, that should get us a shorter log to show to the user and it should easier to print since we dont need to care about job's dependencies, just sequential steps

@GustavEikaas
Copy link
Contributor Author

Ill keep digging! It would be easier if anyone could link me a specific workflow run that causes it to error out

Copy link
Collaborator

@wd60622 wd60622 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments.

Also, been thinking about the use of zip files (Still don't have working in all cases for me)...
Do the logs have to stored to file system? There are other items that are just stored in the local variable M. Can that strategy also be used?

@GustavEikaas
Copy link
Contributor Author

Also, been thinking about the use of zip files (Still don't have working in all cases for me)...
Do the logs have to stored to file system? There are other items that are just stored in the local variable M. Can that strategy also be used?

Github supports two ways of giving workflow logs.

  1. as one big .txt file, I tried this first but it isnt structured well enough that I can map it correctly to the jobs and steps.
  2. As a zip archive. With corresponding .txt files per step where the structure is zipRoot/<jobname>/stepname.txt

I dont necessarily have to write the zip archive to disk but I need some sort of tool/library to extract the files from the zip archive for me. There is no inbuilt lua/vim support for zip archives. I chose unzip because it is included when installing git. AFAIK unzip doesnt accept inline zip archive as stdio. If you know of any other ways to do this im all ears.

I looked a bit more into the issue and I can no longer repro the issue but apparently you can. Do you have any repro on a public OSS repo where you can link me the workflow run. If I can repro the issue I can probably fix it

@wd60622
Copy link
Collaborator

wd60622 commented Feb 22, 2025

Overall, it seems to be working fairly well for most cases. I can get some on the second try. I am having trouble with:

EDIT: I added the <C-y> mapping to copy URL. (my browser doesn't work).

@wd60622
Copy link
Collaborator

wd60622 commented Feb 22, 2025

Some other nice to have features:

  • Have the > become when expanded for a better visual representation
  • Have the o mapping close the node from within the line range. For instance, cursor in the logs being shown.

@wd60622
Copy link
Collaborator

wd60622 commented Feb 22, 2025

Other than that, think this is pretty much good to go. We can get it out, people can try, and we iterate! It's awesome addition so thanks for all of the back and forth!

@GustavEikaas
Copy link
Contributor Author

I see the issue with the workflow run you linked @wd60622
X64-ubuntu (ubuntu-20.04, httpsgithub.comneovimneovimreleasesdownloadv0.10.0nvim-linux64.../3_Run date +%F todays-date.txt - API
X64-ubuntu (ubuntu-20.04, httpsgithub.comneovimneovimreleasesdownloadv0.10.0nvim-linux64../3_Run date +%F todays-date.txt - Archive

TLDR; main issue is length being truncated. Honestly dont know how to work around this without making a bunch of code for processing and transforming paths and filenames. I'm afraid it will never be 100% with this approach

@GustavEikaas
Copy link
Contributor Author

Made a final attempt using some wildcard tricks. @wd60622.
Do you want to do a final test and see if you can read workflow logs without any errors now?

@wd60622
Copy link
Collaborator

wd60622 commented Feb 22, 2025

Will take a look tomorrow and let you know how it goes

Is there a Json payload that comes back too? Maybe we can use some type of id instead of a raw name

Copy link
Collaborator

@wd60622 wd60622 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, more successes than failures! But let's get this through. Awesome feature! 🚀

@wd60622 wd60622 merged commit d514e01 into pwntester:master Feb 23, 2025
3 checks passed
@GustavEikaas
Copy link
Contributor Author

Thanks! It's been a journey, mostly fun though. Glad we could finally release it!

Feel free to tag me in any future issues relating to this.

@GustavEikaas GustavEikaas deleted the feat/octo-run-list branch February 23, 2025 08:55
@wd60622
Copy link
Collaborator

wd60622 commented Feb 23, 2025

Totally, I know how it goes. Thanks for sticking in there.

Feel free to open Issues for any features as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request - GitHub actions
3 participants