• Stars
    star
    326
  • Rank 124,537 (Top 3 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created about 1 year ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Live display of current GitHub action runs

Watch GitHub Action runs

This package provides one command, watch_gha_runs. It displays the status of the latest GitHub Action runs your current branch. If any of the runs are in progress, it will refresh the display repeatedly with the latest status.

If you like, the name can be pronounced, "Watching? Ha!"

Installation

I suggest installing with pipx:

$ pipx install watchgha

Now you have a command watch_gha_runs available.

For complex defaulting, you can use a git alias. For example, this provides the same defaults, but can be adapted:

[alias]
    runs = "!f() { \
        watch_gha_runs $@ \
            \"$(git remote get-url origin)\" \
            \"$(git rev-parse --abbrev-ref HEAD)\"; \
    }; f"

Now git runs will show a live display of the current runs on your branch.

You can authenticate against GitHub if needed using either an entry in your .netrc file, or by setting the GITHUB_TOKEN environment variable.

Usage

$ watch_gha_runs --help
Usage: watch_gha_runs [OPTIONS] [REPO] [BRANCH]

  Watch GitHub Action runs.

  Repeatedly gets the latest status and redraws the screen, until all
  of the jobs are complete.

  REPO is a local directory or GitHub URL, defaulting to ".".

  BRANCH is defaulted from the git repo.

Options:
  --sha TEXT        The commit SHA to use. Must be a full SHA.
  --poll INTEGER    How many seconds between refreshes.  [default: 15]
  --wait-for-start  Wait for jobs to start
  --help            Show this message and exit.

Display

The output shows runs and jobs. The current step of each job is shown, with a row of bullets indicating the number of steps, and which is current:

https://raw.githubusercontent.com/nedbat/watchgha/main/watch.gif

fix: recent pypy3.9 now omits lines after jumps nedbat/fix-pypy-nightly    53923268e8f9  @08:32am
⏲ queued       Tests             view 4397455341
    3.7 on ubuntu                  ↻ •••••••• Run tox for 3.7
    3.8 on ubuntu                  ↻ •••••••• Run tox for 3.8
    3.9 on ubuntu                  ↻ •••••••• Run tox for 3.9
    3.10 on ubuntu                 ↻ •••••••• Run tox for 3.10
    3.11 on ubuntu                 ↻ •••••••• Run tox for 3.11
    pypy-3.7 on ubuntu             ↻ •••••••• Run tox for pypy-3.7
    pypy-3.9 on ubuntu             ↻ •••••••• Run tox for pypy-3.9
    3.7 on macos                   ↻ •••••••• Run tox for 3.7
    3.8 on macos                   ↻ •••••••• Run tox for 3.8
    3.9 on macos                   ⏲ queued
    3.10 on macos                  ↻ •••••••• Run tox for 3.10
    3.11 on macos                  ↻ •••••••• Run tox for 3.11
    pypy-3.7 on macos              ⏲ queued
    pypy-3.9 on macos              ⏲ queued
    3.7 on windows                 ⏲ queued
    3.8 on windows                 ⏲ queued
    3.9 on windows                 ⏲ queued
    3.10 on windows                ↻ ••••••• Check out the repo
    3.11 on windows                ⏲ queued
    pypy-3.7 on windows            ⏲ queued
↻ in_progress  Quality            view 4397455342
    Check types                    ✓ success
    Build docs                     ↻ ••••••• Tox doc
    Pylint etc                     ↻ ••••••• Tox lint
↻ in_progress  Python Nightly Tests   view 4397455346
    Python 3.10-dev                ↻ •••◦•••• Run tox
    Python 3.11-dev                ↻ •••◦•••• Run tox
    Python 3.12-dev                ↻ •••◦•••• Run tox
    Python pypy-3.7-nightly        ↻ ••◦•••••• Run tox
    Python pypy-3.8-nightly        ↻ ••◦•••••• Run tox
    Python pypy-3.9-nightly        ↻ ••◦•••••• Run tox

Jobs and runs are collapsed once all of their children are successful:

fix: recent pypy3.9 now omits lines after jumps nedbat/fix-pypy-nightly    53923268e8f9  @08:32am
✓ success      Tests              view 4397455341
↻ in_progress  Quality            view 4397455342
    Check types                    ✓ success
    Build docs                     ↻ ••••••• Tox doc
    Pylint etc                     ✓ success
✗ failure      Python Nightly Tests   view 4397455346
    Python 3.10-dev                ✓ success
    Python 3.11-dev                ✓ success
    Python 3.12-dev                ✓ success
    Python pypy-3.7-nightly        ✓ success
    Python pypy-3.8-nightly        ✓ success
    Python pypy-3.9-nightly        ✗ failure Run tox

Once all the runs are completed, the command ends, displaying the final status:

fix: recent pypy3.9 now omits lines after jumps nedbat/fix-pypy-nightly [push]   53923268e8f9  @08:32am
✓ success      Tests              view 4397455341
✓ success      Quality            view 4397455342
✗ failure      Python Nightly Tests   view 4397455346
    Python 3.10-dev                ✓ success
    Python 3.11-dev                ✓ success
    Python 3.12-dev                ✓ success
    Python pypy-3.7-nightly        ✓ success
    Python pypy-3.8-nightly        ✓ success
    Python pypy-3.9-nightly        ✗ failure Run tox

Changelog

2.1.1 — 2023-07-05

  • Implicit .netrc authentication stopped working, but has been fixed. Thanks, Rob Weir.

2.0.0 — 2023-07-02

  • The default polling interval is now 15 seconds.
  • Now the GitHub repo location and branch name are defaulted from the current git repo. The repo location can be a local directory or GitHub URL. Closes issue 7.
  • A new option, --wait-for-start will make watch_gha_runs wait until jobs are in progress. This fixes a problem with using watch_gha_runs programmatically: it can check the run status before any new runs have started, and simply report the done state of the last bunch of runs, then quit.
  • Fix: if a .yml workflow file couldn't be parsed, its "run" would persist in the list of runs for longer than it should. Now those unparsable runs aren't displayed at all.
  • Fix: skipped runs are considered finished, and don't need their jobs shown.
  • Error reporting is improved, removing unneeded noisy tracebacks in some cases, and providing more information for GitHub API errors. Closes issue 8.
  • More operations are retried on failure, fixing issue 10.
  • Interrupting with ctrl-C will set the exit status to 2.

1.0.0 — 2023-04-15

  • The --poll option sets the number of seconds to wait between refreshes.
  • Requests to GitHub are now made asynchronously, speeding execution.
  • Redirections from GitHub (for example, if a repo is renamed or moved) are followed transparently.
  • The exit code is now 1 if any runs failed, 0 if all were successful.
  • Long lines are no longer wrapped too short.

0.6.0 — 2023-03-22

  • Runs can be selected by a commit SHA by using --sha on the command line.
  • Retry if GitHub returns "502 - Bad Gateway".

0.5.0 — 2023-03-15

  • Uses a GITHUB_TOKEN environment variable for authentication if it is defined.

0.0.2 — 2023-03-14

  • Support more forms of repo URLs: [email protected]:, without .git, etc.
  • Better error messages if the repo URL can't be parsed.

0.0.1 — 2023-03-13

First version

Development

The code is a bit messy and undocumented, and there are no tests. If you want to change the code, open an issue and let's talk about it.

Contributors:

  • Ned Batchelder
  • Hugo van Kemenade
  • Rob Weir

Back Story

This started as a formatter for the output of gh run list from the gh run command. Then I tried gh run watch, but wasn't happy with its choices. So I wrote my own.

More Repositories

1

coveragepy

The code coverage tool for Python
Python
2,791
star
2

byterun

A Python implementation of a Python bytecode runner
Python
1,266
star
3

cog

Small bits of Python computation for static files
Python
318
star
4

scriv

Changelog management tool
Python
241
star
5

django_coverage_plugin

A plugin for coverage.py to measure Django template execution
Python
193
star
6

dinghy

A GitHub activity digest tool
Python
181
star
7

pkgsample

A simple example of how to structure a Python project
Python
82
star
8

truchet

Playing with Truchet tiles
Jupyter Notebook
47
star
9

gefilte

Gefilte Fish GMail filter creator
Python
41
star
10

pydoctor

A diagnostic program to show the Python environment
Python
27
star
11

dot

Personal dotfiles
Shell
25
star
12

pytest-gallery

A sampler of tests showing different ways to construct tests for pytest
Python
24
star
13

aptus

Mandelbrot fractal viewer
Python
20
star
14

pylintdb

Put pylint violations into sqlite
Python
19
star
15

cupid

Python
19
star
16

choosy

A Python teaching tool
Python
19
star
17

zellij

A toy for making geometric art, inspired by Islamic Zellij.
Python
18
star
18

flourish

Harmonograph toy
Python
13
star
19

gpxmapper

Python
12
star
20

adventofcode2017

Python
10
star
21

adventofcode2018

Python
9
star
22

unittest-mixins

Helpful unittest mixin classes
Python
9
star
23

adventofcode2020

Python
8
star
24

unipain

PyCon presentation: Pragmatic Unicode, or, How Do I Stop the Pain?
HTML
8
star
25

adventofcode2019

Python
8
star
26

odds

Odds & Ends
Python
8
star
27

iter

PyCon presentation about iteration
HTML
7
star
28

nedbatcom

nedbatchelder.com
HTML
7
star
29

song-basket

Simple Spotify app to collect songs into a basket playlist.
Python
6
star
30

pyhurry

Python
6
star
31

adventofcode2021

Python
6
star
32

nedbat

nedbat's profile
Shell
5
star
33

adventofcode2015

Python
5
star
34

adventofcode2022

adventofcode 2022
Python
5
star
35

adventofcode2016

Python
5
star
36

coverage_pytest_plugin

Python
5
star
37

adventures_prz

A presentation
JavaScript
4
star
38

coverage-reports

HTML
4
star
39

injectx

Python
4
star
40

test0

PyCon presentation: Getting Started Testing
HTML
4
star
41

pgeom

Jupyter Notebook
4
star
42

toomuchregex

A lightning talk
JavaScript
4
star
43

native-matrix

4
star
44

templite

Python
4
star
45

typing_app

JavaScript
4
star
46

blowyournose

Python
3
star
47

stilted

Python
3
star
48

bigo

HTML
3
star
49

version_dummy

Absolute minimal versioned Python package.
Shell
3
star
50

jreport

Utility for making console reports from JSON APIs
Python
3
star
51

hello-github-actions

3
star
52

commitstats

Jupyter Notebook
3
star
53

natsworld

Python
3
star
54

point_match

A presentation.
HTML
3
star
55

blogtools

Python
3
star
56

explainer

3
star
57

tabtest

Python
3
star
58

branch-tests

2
star
59

toxghabug

2
star
60

xunit_tools

Janky tools for doing things with xunit.xml files
Python
2
star
61

ndindex

A Python library for manipulating indices of ndarrays
Python
2
star
62

sarai

HTML
2
star
63

madlib

Python
2
star
64

blank_prz

A blank presentation, using my own crappy toolchain
JavaScript
2
star
65

django_issue_25793

Demo for https://code.djangoproject.com/ticket/25793
Python
2
star
66

prznames

HTML
2
star
67

dinghy_sample

An example of publishing Dinghy digests
HTML
2
star
68

wikicrawl

Python
2
star
69

cyclorama

Python
1
star
70

adventofcode2023

Python
1
star
71

nedbat_dinghy

HTML
1
star
72

hackathon-edx-exams-copy

Python
1
star
73

pytest-cov

Coverage plugin for pytest.
Python
1
star