a working pipeline configured using Github acdtions
installation of gh
command :
https://cli.github.com/manual/installation
and likely
https://github.com/cli/cli/blob/trunk/docs/install_linux.md
if your a linux person, like me
a working pipeline configured using Github acdtions
installation of gh
command :
https://cli.github.com/manual/installation
and likely
https://github.com/cli/cli/blob/trunk/docs/install_linux.md
if your a linux person, like me
GITHUB_REPO=< repo url from github [Code] HTTPS ... but without 'https://' at the beginning > | |
GITHUB_TOKEN=< github token from Github 'user' settings, developer settings, Personal access tokens - create a token with code, workspace and org > | |
GITHUB_USER=< your github user account name > | |
CLONE_REPO_DIR=< path to the directory into which the repo will be copied / cloned > | |
GITHUB_WORKFLOW=< the file name of the github workflow file you want to be run - see the .github/workflows directory at the root of your repo > |
#!/usr/bin/env bash | |
. .env | |
echo "cloning repo [${GITHUB_REPO}] with pipeline that we want to run ..." | |
[ -d $CLONE_REPO_DIR ] && echo "ERROR : the directory [${CLONE_REPO_DIR}] already exists, exiting ..." && exit 1 | |
git clone "https://${GITHUB_USER}:${GITHUB_TOKEN}@${GITHUB_REPO}" $CLONE_REPO_DIR | |
cd ${CLONE_REPO_DIR} | |
echo "attemptiong to log in to a gitbub account ..." | |
echo $GITHUB_TOKEN | gh auth login --with-token | |
echo "attemptingt to run the pipeline for [${GITHUB_REPO}] ..." | |
gh workflow run ${GITHUB_WORKFLOW} | |
cd - | |
rm -rf ${CLONE_REPO_DIR} |