Skip to content

Commit

Permalink
Check if repo exists/install if it doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
sounddrill31 authored Mar 7, 2024
1 parent 6a7246d commit b59f5ca
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,21 @@ jobs:
# Download and configure 'repo'.
- name: Configure the 'repo' environment
run: |
mkdir "${HOME}/bin"
curl https://storage.googleapis.com/git-repo-downloads/repo >> "${HOME}/bin/repo"
chmod a+x "${HOME}/bin/repo"
sudo ln -sf "/home/${USER}/bin/repo" "/usr/bin/repo"
# Check if repo is already installed
if ! command -v repo >/dev/null 2>&1; then
echo "Repo not found. Installing now..."
# Create bin directory if it doesn't exist
mkdir -p ~/bin
# Download repo script
curl https://storage.googleapis.com/git-repo-downloads/repo >> ~/bin/repo
# Make repo script executable
chmod a+x ~/bin/repo
# Create symbolic link to /usr/bin/repo
sudo ln -sf "/home/$(whoami)/bin/repo" "/usr/bin/repo"
echo "Repo installation complete."
else
echo "Repo already installed."
fi
continue-on-error: true

# Generate 'git' credential in base of the workflow's author.
Expand Down
19 changes: 15 additions & 4 deletions .github/workflows/selfhosted.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,21 @@ jobs:
# Download and configure 'repo'.
- name: Configure the 'repo' environment
run: |
mkdir "${HOME}/bin"
curl https://storage.googleapis.com/git-repo-downloads/repo >> "${HOME}/bin/repo"
chmod a+x "${HOME}/bin/repo"
sudo ln -sf "/home/${USER}/bin/repo" "/usr/bin/repo"
# Check if repo is already installed
if ! command -v repo >/dev/null 2>&1; then
echo "Repo not found. Installing now..."
# Create bin directory if it doesn't exist
mkdir -p ~/bin
# Download repo script
curl https://storage.googleapis.com/git-repo-downloads/repo >> ~/bin/repo
# Make repo script executable
chmod a+x ~/bin/repo
# Create symbolic link to /usr/bin/repo
sudo ln -sf "/home/$(whoami)/bin/repo" "/usr/bin/repo"
echo "Repo installation complete."
else
echo "Repo already installed."
fi
continue-on-error: true

# Generate 'git' credential in base of the workflow's author.
Expand Down

0 comments on commit b59f5ca

Please sign in to comment.