Skip to content

feature: add --watch option to gh workflow run - #6965

Closed
mik3y wants to merge 1 commit into
cli:trunkfrom
mik3y:mikey/run-watch
Closed

mik3y wants to merge 1 commit into
cli:trunkfrom
mik3y:mikey/run-watch

Conversation

@mik3y

@mik3y mik3y commented Feb 4, 2023

Copy link
Copy Markdown

Implementation is somewhat brittle due to #4001, but works adequately.

Fixes #3559. Would be improved by #4001

@mik3y
mik3y requested a review from a team as a code owner February 4, 2023 19:26
@mik3y
mik3y requested review from vilmibm and removed request for a team February 4, 2023 19:26
@cliAutomation cliAutomation added the external pull request originating outside of the CLI core team label Feb 4, 2023
@samcoe samcoe added the discuss Feature changes that require discussion primarily among the GitHub CLI team label Feb 5, 2023

@vilmibm vilmibm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for working on this. I appreciate your trying to work around the GitHub platform limitation. I'm concerned about how brittle this is; it's easy to imagine ending up watching the wrong run on a repository with frequent runs.

Is there a way to make this more reliable by filtering runs by workflow file and ref? If not I fear that this PR should be closed for now.

@mik3y

mik3y commented Mar 3, 2023

Copy link
Copy Markdown
Author

I'm concerned about how brittle this is; it's easy to imagine ending up watching the wrong run on a repository with frequent runs.

No debate on that here!

Is there a way to make this more reliable by filtering runs by workflow file and ref?

That seems like it should be possible, although (being as new as this PR to the code overall) I'm not certain. I'll take a look and report back.

@mislav mislav changed the title feature: add --watch option to gh workflow run (Fixes #3559) feature: add --watch option to gh workflow run Mar 20, 2023
@mislav mislav removed the discuss Feature changes that require discussion primarily among the GitHub CLI team label Apr 24, 2023
@williammartin
williammartin self-requested a review September 11, 2023 16:01
@williammartin

Copy link
Copy Markdown
Member

Hey @mik3y, since @vilmibm is no longer at GitHub, I've assigned this to myself to review. The last message was you planning to make some changes and coming back to us. Are you planning to continue working on this and if so is there something we can do to help you move this forward?

Implementation is somewhat brittle due to cli#4001, but works adequately.

Outstanding issues:
- No way to pass additional arguments (such as timeout) to `gh run watch`
- Very likely to be brittle, especially in busy repos

Issue cli#3559.
@mik3y

mik3y commented Oct 30, 2023

Copy link
Copy Markdown
Author

@williammartin thanks for the nudge! I think this is ready for another look.

In addition to rebasing, I've applied vilmibm's prior suggestion to use an additional filter (the workflow id) when searching for the "new" run ID. It's been working well.

It would still be preferable to close #4001 and resolve this without needing a heuristic, but such an improvement could could of course be made later, under-the-hood of the new --watch interface.

@samcoe samcoe added the blocked label Nov 8, 2023
@piyush1104

Copy link
Copy Markdown

It will fail if there are multiple runs created for same workflow. You might end up watching for other run

@andyfeller

Copy link
Copy Markdown
Contributor

@williammartin thanks for the nudge! I think this is ready for another look.

In addition to rebasing, I've applied vilmibm's prior suggestion to use an additional filter (the workflow id) when searching for the "new" run ID. It's been working well.

It would still be preferable to close #4001 and resolve this without needing a heuristic, but such an improvement could could of course be made later, under-the-hood of the new --watch interface.

@mik3y: Yeah, having the GitHub REST API endpoints for creating workflow runs return an ID on call is a question / comment / suggestion I've seen within our internal subject matter experts GitHub Actions channel for some time. I've followed up internally to add the GitHub CLI to the list of customers and other users who have requested this.

All that said, I'll defer to @williammartin as having been working with you on the issue on your updates and the concern raised about selecting the right workflow run.

@andyfeller

Copy link
Copy Markdown
Contributor

@mik3y : I'm going to close this PR rather than keeping this it open indefinitely while I continue to advocate for the GitHub Actions team to enhance Create a workflow dispatch event REST endpoint. There appears to be added complexity with correlating workflow runs depending on whether you use .run-name feature of a workflow that I think we want to wait for the dispatch endpoint to return the ID in order to implement this feature.

Once again, thank you for your time and patience! ❤️ 🙇

@andyfeller andyfeller closed this Feb 28, 2024
@mik3y

mik3y commented Feb 28, 2024

Copy link
Copy Markdown
Author

@andyfeller understood, thanks for pushing on the blocker issue.

For anyone coming to this issue/PR in the meantime, fwiw, I've been running a build of this fork as my ~/bin/gh & enjoying gh workflow run --watch for over a year with success; so it might tide you over until #4001 is resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked external pull request originating outside of the CLI core team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option to watch workflow run progress

8 participants