π OpenHands: AI-Driven Development
fix ghcr workflow throw error when in the fork repo. (#1203)
Leo34286fabcc8d
diff --git a/.github/workflows/ghcr.yml b/.github/workflows/ghcr.ymlindex ced9804d73..e6187d6693 100644--- a/.github/workflows/ghcr.yml+++ b/.github/workflows/ghcr.yml@@ -32,4 +32,6 @@ jobs:run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin- name: Build and push ${{ matrix.image }}- run: ./containers/build.sh ${{ matrix.image }} --push+ run: |+ ORG_NAME=$(echo "${{ github.repository }}" | tr '[A-Z]' '[a-z]' | cut -d '/' -f 1)+ ./containers/build.sh ${{ matrix.image }} $ORG_NAME --pushdiff --git a/containers/app/config.sh b/containers/app/config.shindex 2082324826..187c90b209 100644--- a/containers/app/config.sh+++ b/containers/app/config.sh@@ -1,2 +1,4 @@-DOCKER_REPOSITORY=ghcr.io/opendevin/opendevin+DOCKER_REGISTRY=ghcr.io+DOCKER_ORG=opendevin+DOCKER_IMAGE=opendevinDOCKER_BASE_DIR="."diff --git a/containers/build.sh b/containers/build.shindex b20395e4c7..ef30e0d150 100755--- a/containers/build.sh+++ b/containers/build.sh@@ -2,8 +2,9 @@set -eo pipefailimage_name=$1+org_name=$2push=0-if [[ $2 == "--push" ]]; then+if [[ $3 == "--push" ]]; thenpush=1fi@@ -31,6 +32,10 @@ if [ ! -f $dir/config.sh ]; thenexit 1fisource $dir/config.sh+if [[ -n "$org_name" ]]; then+ DOCKER_ORG="$org_name"+fi+DOCKER_REPOSITORY=$DOCKER_REGISTRY/$DOCKER_ORG/$DOCKER_IMAGEecho "Repo: $DOCKER_REPOSITORY"echo "Base dir: $DOCKER_BASE_DIR"#docker pull $DOCKER_REPOSITORY:main || true # try to get any cached layersdiff --git a/containers/evaluation/config.sh b/containers/evaluation/config.shindex 421fe371a5..afcb2c228a 100644--- a/containers/evaluation/config.sh+++ b/containers/evaluation/config.sh@@ -1,2 +1,4 @@-DOCKER_REPOSITORY=ghcr.io/opendevin/eval-swe-bench+DOCKER_REGISTRY=ghcr.io+DOCKER_ORG=opendevin+DOCKER_IMAGE=eval-swe-benchDOCKER_BASE_DIR=evaluation/SWE-benchdiff --git a/containers/sandbox/config.sh b/containers/sandbox/config.shindex 2a14a21e29..3b96dac3b3 100644--- a/containers/sandbox/config.sh+++ b/containers/sandbox/config.sh@@ -1,2 +1,4 @@-DOCKER_REPOSITORY=ghcr.io/opendevin/sandbox+DOCKER_REGISTRY=ghcr.io+DOCKER_ORG=opendevin+DOCKER_IMAGE=sandboxDOCKER_BASE_DIR="."