This repository provides a Bash script wrapper for the GitHub CLI (gh
) to streamline operations in a Dockerized environment. The script simplifies workflows by eliminating the need to manually install and configure the gh
CLI on your local machine.
- Secrets Management: Easily set and manage repository secrets from files, stdin, or environment variables.
- Containerized Execution: Run all GitHub CLI commands inside a Docker container for isolation and simplicity.
- Minimal Local Setup: No need to install the GitHub CLI or manage dependencies locally.
- Docker installed and running on your system.
git clone https://github.com/VladShyrokyi/github-cli-wrapper.git
cd github-cli-wrapper
Copy the wrapper script (gh.sh
) to a any directory:
cp gh.sh ~/gh.sh
The wrapper script (gh.sh
) simplifies the execution of gh
commands within the Docker container. Below are common usage patterns:
-
From stdin:
~/gh.sh -r my-repo --env-stdin <<< "SECRET_KEY=my-secret-value"
-
From a file:
~/gh.sh -r my-repo --env-file /path/to/secrets.env
-
Direct variable assignment:
~/gh.sh -r my-repo -e API_TOKEN=abc123 -e DB_PASSWORD=secret123
-
From a file:
~/gh.sh -f /path/to/script.sh
-
From stdin:
~/gh.sh --stdin << EOF echo "Hello from stdin script!" EOF
Running the script without arguments launches an interactive session:
~/gh.sh
The script automatically stores GitHub CLI credentials in a gh
folder located in the same directory as the script. Ensure that this folder is secure and accessible only by authorized users.
To remove unused Docker images or resources, you can clean up using standard Docker commands:
docker image prune -f
# Also remove the gh folder containing credentials
rm -rf ~/gh
This project is licensed under the MIT License. See the LICENSE file for more details.
Contributions are welcome! Feel free to open an issue or submit a pull request.