Bash to basics.
These scripts are things I've been using in different places over the years.
Help yourself.
jobs:
example:
steps:
- uses: jonpugh/goatscripts@v1run-with-summary: Runs a command and generates a markdown summary with output and execution details.wait-for: Runs a command repeatedly until it passes.
run-with-summary my-long-command
Executes a command, prints logs, and saves a markdown summary.
jobs:
example:
name: "Test GitHub Actions"
steps:
- uses: jonpugh/goatscripts@v1
- name: Install helper scripts
uses: jonpugh/goatscripts@main
# NOTE: You do NOT have to echo to $GITHUB_STEP_SUMMARY! The run-with-summary script does it automatically 👏
- run: run-with-summary ls -la goatscripts
The script was designed to be most useful on GitHub, but you can use it anywhere.
GitHub step summaries are saved permanently. Here is an example:
Customize the output with environment variables. See the run-with-summary script for more details.
jobs:
deploy:
steps:
- uses: jonpugh/goatscripts@v1
- run: run-with-summary deploy.sh
env:
SUCCESS: "Deploy complete! :rocket:"
ERROR: "Deploy failed! :boom:"
SUMMARY: |
Set SUMMARY env var to add *any* markdown **you want** to the report file.
runs a command until it passes or timeout is reached.
- Docker containers that have to wait for a database server to start
- Test scripts that have to wait for your project to initialize.
- Better than "sleep": Sometimes you need to wait. Instead of sleeping a fixed number of seconds, run a command that will pass once the thing you need is ready.
wait-for mysql-ready
wait-for curl https://deploy-url/ready
# SLEEP: Length of time to wait in-between running the command.
# CHAR: The character to print after every command run.
# OUTPUT: Set to 'all' to print all output, set to 'out' to print just stdOut, set to "err" to print just stdErr.
# TIMEOUT: Default: 30. Exit with an error if process doesn't pass within this time.
# SILENT: Set to 1 to not print any output except the timeout exceeded error. Useful when running from other scripts. See wait-mysql
Originally developed during the course of building opendevshop.
Moved to operations/scripts https://github.com/operations-project/scripts
Bringing it back to me. It's always been a personal project.