Short version. You want automation that runs predictable shell scripts inside GitHub Actions so your CI does the boring work and not your future self. This guide gives the exact steps to create a shell script, make it executable, wire it into a workflow, and troubleshoot permission and path problems that will inevitably show up.
Put a file under scripts or in the repo root and start it with a proper interpreter line. Use bash if you are using bash features. Keep it small and testable.
#!/bin/bash
set -e
set -o pipefail
echo "Hello from the script"
# run build or test commands here
Notes
Runners are not mind readers. They need the execute bit. Locally run
chmod +x scripts/run_tests.sh
If you want the permission change to persist in the repo you can do
git add --chmod=+x scripts/run_tests.sh
git commit -m "make script executable"
Create a workflow file under .github/workflows that runs on a runner that matches your shell needs. If you need bash features pick a Linux runner such as ubuntu-latest. The workflow steps you need are simple
Example step list that you can adapt
# in your workflow job steps
use actions/checkout@v3
run chmod +x scripts/run_tests.sh
run ./scripts/run_tests.sh
The runner executes the command using the default shell for the platform. On ubuntu-latest the default shell supports bash like behavior in most cases. If your script relies on bash specific builtins then ensure the shebang is correct and use a Linux runner.
Logs are your friend. The Actions tab shows step by step output and failing line numbers. Add echo statements or a debug step that prints the workspace, ls output, and env so you are not surprised.
run echo "pwd is $(pwd)" && ls -la scripts
If you follow these steps your script will run inside GitHub Actions and do the boring, repeatable work you paid for. If it breaks consult the logs and then add more echoes until you feel better.
I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!
This is a dedicated watch page for a single video.