Skip to content

Commit 72939e0

Browse files
authored
Provide workaround for circular dependency (#3361)
1 parent 2715608 commit 72939e0

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

.github/workflows/jobs.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,18 @@ jobs:
120120
uses: actions/checkout@v3
121121
with:
122122
repository: minio/minio
123+
- name: Check-out matching MinIO branch
124+
env:
125+
GH_BRANCH: ${{ github.head_ref || github.ref_name }}
126+
GH_PR_REPO: ${{ github.event.pull_request.head.repo.full_name }}
127+
run: |
128+
GH_PR_ACCOUNT=`echo $GH_PR_REPO | sed "s/\\/.*//"`
129+
if [ ! -z "$GH_PR_ACCOUNT" ] && [ ! "$GH_PR_ACCOUNT" = "minio" ]; then
130+
ALTREPO="https://github.com/$GH_PR_ACCOUNT/minio.git"
131+
echo "Attempting to fetch $ALTREPO..."
132+
git remote add alt $ALTREPO
133+
(git fetch alt && git checkout "alt/$GH_BRANCH") || echo "$ALTREPO ($GH_BRANCH) not available, so keeping default repository/branch"
134+
fi
123135
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
124136
uses: actions/setup-go@v3
125137
with:
@@ -817,6 +829,18 @@ jobs:
817829
with:
818830
repository: minio/minio
819831
path: "minio_repository"
832+
- name: Check-out matching MinIO branch
833+
env:
834+
GH_BRANCH: ${{ github.head_ref || github.ref_name }}
835+
GH_PR_REPO: ${{ github.event.pull_request.head.repo.full_name }}
836+
run: |
837+
GH_PR_ACCOUNT=`echo $GH_PR_REPO | sed "s/\\/.*//"`
838+
if [ ! -z "$GH_PR_ACCOUNT" ] && [ ! "$GH_PR_ACCOUNT" = "minio" ]; then
839+
ALTREPO="https://github.com/$GH_PR_ACCOUNT/minio.git"
840+
echo "Attempting to fetch $ALTREPO..."
841+
git remote add alt $ALTREPO
842+
(git fetch alt && git checkout "alt/$GH_BRANCH") || echo "$ALTREPO ($GH_BRANCH) not available, so keeping default repository/branch"
843+
fi
820844
- uses: actions/cache@v3
821845
id: minio-latest-cache
822846
name: MinIO Latest Cache
@@ -910,6 +934,18 @@ jobs:
910934
with:
911935
repository: minio/minio
912936
path: "minio_repository"
937+
- name: Check-out matching MinIO branch
938+
env:
939+
GH_BRANCH: ${{ github.head_ref || github.ref_name }}
940+
GH_PR_REPO: ${{ github.event.pull_request.head.repo.full_name }}
941+
run: |
942+
GH_PR_ACCOUNT=`echo $GH_PR_REPO | sed "s/\\/.*//"`
943+
if [ ! -z "$GH_PR_ACCOUNT" ] && [ ! "$GH_PR_ACCOUNT" = "minio" ]; then
944+
ALTREPO="https://github.com/$GH_PR_ACCOUNT/minio.git"
945+
echo "Attempting to fetch $ALTREPO..."
946+
git remote add alt $ALTREPO
947+
(git fetch alt && git checkout "alt/$GH_BRANCH") || echo "$ALTREPO ($GH_BRANCH) not available, so keeping default repository/branch"
948+
fi
913949
- uses: actions/cache@v3
914950
id: minio-latest-cache
915951
name: MinIO Latest Cache
@@ -981,6 +1017,24 @@ jobs:
9811017
with:
9821018
repository: minio/minio
9831019
path: "minio_repository"
1020+
- name: Check-out matching MinIO branch
1021+
env:
1022+
GH_BRANCH: ${{ github.head_ref || github.ref_name }}
1023+
GH_PR_REPO: ${{ github.event.pull_request.head.repo.full_name }}
1024+
run: |
1025+
GH_PR_ACCOUNT=`echo $GH_PR_REPO | sed "s/\\/.*//"`
1026+
if [ ! -z "$GH_PR_ACCOUNT" ] && [ ! "$GH_PR_ACCOUNT" = "minio" ]; then
1027+
ALTREPO="https://github.com/$GH_PR_ACCOUNT/minio.git"
1028+
echo "Attempting to fetch $ALTREPO..."
1029+
git remote add alt $ALTREPO
1030+
(git fetch alt && git checkout "alt/$GH_BRANCH") || echo "$ALTREPO ($GH_BRANCH) not available, so keeping default repository/branch"
1031+
fi
1032+
1033+
- name: Checkout proper minio/minio branch
1034+
run: |
1035+
1036+
git checkout "${{ github.head_ref || github.ref_name }}" || echo "Okay, we'll stay on the master branch"
1037+
9841038
- uses: actions/cache@v3
9851039
id: minio-latest-cache
9861040
name: MinIO Latest Cache

0 commit comments

Comments
 (0)