From c91ff7e5a35cdb4fe6d71507e9e39fa66a6e1ec1 Mon Sep 17 00:00:00 2001 From: nikosbosse Date: Wed, 27 Nov 2024 21:27:41 +0100 Subject: [PATCH] try fixing gh actions again --- .github/workflows/submit-covid-forecasts.yaml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/submit-covid-forecasts.yaml b/.github/workflows/submit-covid-forecasts.yaml index 2381d0f..a5ee03f 100644 --- a/.github/workflows/submit-covid-forecasts.yaml +++ b/.github/workflows/submit-covid-forecasts.yaml @@ -62,8 +62,15 @@ jobs: # Install GitHub CLI gh auth login --with-token <<< "${{ secrets.PRIVATE_ACCESS_TOKEN }}" - # Fork the repository (if not already forked) - FORK_DIR=$(gh repo fork CDCgov/covid19-forecast-hub --clone=true --remote=true | grep -o 'Cloning into '"'"'\K[^'"'"']*') + # Check if fork exists and is accessible + if ! gh repo view ${{ github.actor }}/covid19-forecast-hub >/dev/null 2>&1; then + # Fork doesn't exist or is inaccessible, create it + FORK_DIR=$(gh repo fork CDCgov/covid19-forecast-hub --clone=true --remote=true | grep -o 'Cloning into '"'"'\K[^'"'"']*') + else + # Fork exists, clone it directly + git clone "https://${{ secrets.PRIVATE_ACCESS_TOKEN }}@github.com/${{ github.actor }}/covid19-forecast-hub.git" + FORK_DIR="covid19-forecast-hub" + fi # Navigate to the forked repository directory pushd "$FORK_DIR"