actions-cli icon indicating copy to clipboard operation
actions-cli copied to clipboard

Seeing old complete runs rather than runs in progress, when a run hasn't started yet

Open tsutsu opened this issue 4 years ago • 1 comments

I have a script that pushes a tag, and then immediately calls actions-cli to watch the deploy workflow triggered on: create of that tag.

Right now, I need to insert a sleep in my script, because without it, actions-cli just finds the newest existing run (the one from the last deploy), shows it, and exits.

Although my tag has already been pushed, the relevant workflow-run gets created asynchronously on Github's side, and it seemingly takes a few seconds. So if I invoke actions-cli right away, the new run isn't available yet. Instead, it just sees the old runs, and assumes I wanted to see the newest of those.

But of course, I actually want to see the new run; and if hasn't been created yet, I want actions-cli to wait around until it does get created, and then show its progress.

Proposed fix

  • Add a timestamp-valued switch to actions-cli, which will tell it to ignore or avoid matching any workflow-runs that were created before the passed timestamp.
  • Add a boolean switch, to tell actions-cli that if it fails to discover any non-ignored runs (as could happen with the above time-filter in place), it should not exit, but rather should poll the workflow-runs API endpoint until it does successfully find a workflow run that passes the filter.

With these two switches together, I wouldn't need the sleep in my script; instead, I could run e.g. actions-cli --runs-since=... --block-until-found, and it would just sit there until a new workflow-run starts, at which point it would then start logging the progress of that workflow-run.

tsutsu avatar Nov 27 '20 22:11 tsutsu

This cli doesn’t support tags, I would need to change the api endpoint I am using

remorses avatar Nov 29 '20 13:11 remorses