Skip to content

Commit a2c2347

Browse files
committed
added github_actions_latest_log.sh
1 parent c5ae019 commit a2c2347

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

Diff for: github/github_actions_latest_log.sh

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env bash
2+
# vim:ts=4:sts=4:sw=4:et
3+
#
4+
# Author: Hari Sekhon
5+
# Date: 2025-03-21 23:16:42 +0800 (Fri, 21 Mar 2025)
6+
#
7+
# https://github.com/HariSekhon/DevOps-Bash-tools
8+
#
9+
# License: see accompanying Hari Sekhon LICENSE file
10+
#
11+
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
12+
#
13+
# https://www.linkedin.com/in/HariSekhon
14+
#
15+
16+
set -euo pipefail
17+
[ -n "${DEBUG:-}" ] && set -x
18+
srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
19+
20+
# shellcheck disable=SC1090,SC1091
21+
. "$srcdir/lib/github.sh"
22+
23+
# shellcheck disable=SC2034,SC2154
24+
usage_description="
25+
Outputs the text log of the latest GitHub Actions workflow run to the terminal
26+
27+
Useful when the logs are too big for the UI and you have to open it in another tab which is very slow in browser
28+
29+
Uses adjacent script:
30+
31+
github_actions_log.sh
32+
33+
Requires GitHub CLI to be installed and configured
34+
"
35+
36+
# used by usage() in lib/utils.sh
37+
# shellcheck disable=SC2034
38+
usage_args="[<owner>/<repo>]"
39+
40+
help_usage "$@"
41+
42+
max_args 2 "$@"
43+
44+
owner_repo="${1:-}"
45+
46+
if [ -n "$owner_repo" ]; then
47+
is_github_owner_repo "$owner_repo" || die "Invalid GitHub owner/repo given: $owner_repo"
48+
else
49+
owner_repo="$(github_owner_repo)"
50+
fi
51+
52+
"$srcdir/github_actions_log.sh" "$owner_repo" 1

0 commit comments

Comments
 (0)