Last active
December 16, 2021 23:37
-
-
Save macrael/aac6775586cf2449d37e329001fdcd69 to your computer and use it in GitHub Desktop.
This script watches the currently running github action for the current branch and `say`s "Github action run complete" when it finishes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Get Branch Name | |
| branch_name=$(git rev-parse --abbrev-ref HEAD) | |
| # Filter Running Actions | |
| run_line=$(gh run list | grep "$branch_name" | grep "in_progress" | head -n 1) | |
| if [ -z "$run_line" ]; then | |
| echo "No active GH action run found for the current branch" | |
| exit 1 | |
| fi | |
| # Parse out run id | |
| run_id=$(echo "$run_line" | awk '{print $(NF - 2)}') | |
| # Watch that | |
| gh run watch "$run_id" | |
| # say something | |
| say "Github action run complete" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment